當前位置:首頁 » 編程語言 » PHPlink

PHPlink

發布時間: 2025-01-21 22:41:42

㈠ link.php這是什麼文件,要怎麼樣才能打開

link.php是網站後台php程序文件,一般是從某一個頁面跳轉到另一個頁面的文件。

如果想看裡面的代碼,直接用記事本,如果想執行這個文件,就需要一個php的環境。有集成的程序,phpStudy或者AppServ都可以。

㈡ PHP刪除資料庫記錄

1、首先在視圖頁面找到要刪除的id:
<?php
$link=mysql_connect("localhost","root","管理員密碼");
mysql_select_db("infosystem", $link);
$q = "SELECT * FROM info";
mysql_query("SET NAMES GB2312");
$rs = mysql_query($q, $link);

echo "<table>";
echo "<tr><td>部門名稱</td><td>員工姓名</td><td>PC名稱</td></tr>";
while($row = mysql_fetch_object($rs)) echo "<tr><td><a href='dodel.php?id=$row->id'>del</a></td><td>$row->depart</td><td>$row->ename</td></tr>";
echo "</table>";
?>
2、寫一個delete.php頁面,代碼如下:
<?php
$link =mysql_connect("localhost","root","管理員密碼");
mysql_select_db("infosystem", $link);
$del_id=$_GET["id"];
$exec="delete from info where id=$del_id";
mysql_query($exec, $link);
echo "刪除成功!";
mysql_close($link);
?>
說明:用於MySQL數據刪除的SQL語句為:
delete from 表名 where 條件=值
這里的值通過$del_id=$_GET["id"]來接收,並傳遞給SQL語句,最後通過mysql_query來執行這句SQL語句刪除的。

㈢ 用PHP獲取鏈接及圖片路徑的方法

<?php

$str="Thisisatest.Thisisatest.Thisisa<ahref=http://link1.com><imgsrc=http://img1.jpg/></a>test.Thisisatest.Thisisatest. ".
"Thisisatest.Thisisatest.<ahref=http://link2.com><imgsrc=http://img2.jpg/></a>Thisisatest.Thisisatest.Thisisatest. ".
"<ahref=http://link3.com><imgsrc=http://img3.jpg/></a>";

$regex='/<as+href=(.*)s*><imgs+src=(.*)s*/></a>/';
$output=array();

if(preg_match_all($regex,$str,$matches)!==false){
if(isset($matches[1])&&isset($matches[2])){
$links=$matches[1];
$imgs=$matches[2];

foreach($linksas$key=>$link){
$img=isset($imgs[$key])?$imgs[$key]:'';
$output[]="<ahref="{$link}"><imgsrc="{$img}"/></a>";
}
}
}

var_mp($output);

熱點內容
水產資料庫 發布:2025-02-16 22:48:00 瀏覽:904
1p存儲 發布:2025-02-16 22:22:59 瀏覽:312
js調用android 發布:2025-02-16 22:17:50 瀏覽:724
多個伺服器連接成一台電腦 發布:2025-02-16 22:09:41 瀏覽:680
迅雷存儲 發布:2025-02-16 21:53:20 瀏覽:415
電信寬頻20兆上傳速度是多少 發布:2025-02-16 21:28:53 瀏覽:600
layout文件夾 發布:2025-02-16 21:27:17 瀏覽:230
java編譯與執行環境 發布:2025-02-16 21:18:58 瀏覽:986
編程入的拼音 發布:2025-02-16 21:14:54 瀏覽:514
編譯器原理面試 發布:2025-02-16 21:14:40 瀏覽:656