當前位置:首頁 » 編程語言 » htmlphp標簽內容

htmlphp標簽內容

發布時間: 2024-12-30 22:37:54

Ⅰ 求教:php讀取html標簽中內容,插入到資料庫

php可以使用 fopen 打開文件 然後fread讀文件。或者你可以使用file_get_contents獲取文件內容。
然後連接資料庫,把或者的內容,當成一個欄位插入到資料庫對應的欄位里

Ⅱ html使用php參數

<?php
$id=3;
echo"<formid='form1'name='form1'method='post'action='add.php?id=$id'>";
//或
echo'<formid="form1"name="form1"method="post"action="dd.php?id=
'.$id.'">';
?>
//或
<formid="form1"name="form1"method="post"action="add.php?id=<?phpecho$id;?>">

Ⅲ html中插入php的方法

1、第一種是在HTML中加PHP。

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta http-equiv="Content-Language" content="zh-CN" />

<title>Hello World</title>

</head>

<body>

<?php

echo "Hello world!這是正文";

?>

</body>

</html>

Ⅳ php獲取html標簽image的src內容 正則表達式

php獲取html標簽image的src內容 正則表達式寫法如下:
$str = '<img width="100" src="1.gif" height="100">';
preg_match_all('/<img.*?src="(.*?)".*?>/is',$str,$array);
print_r($array);

php對圖片的操作正則表達式詳解:

//1、取整個圖片代碼
preg_match('/<\s*img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i',$str,$match);
echo $match[0];
//2、取width
preg_match('/<img.+(width=\"?\d*\"?).+>/i',$str,$match);
echo $match[1];
//3、取height
preg_match('/<img.+(height=\"?\d*\"?).+>/i',$str,$match);
echo $match[1];
//4、取src
preg_match('/<img.+src=\"?(.+\.(jpg|gif|bmp|bnp|png))\"?.+>/i',$str,$match);
echo $match[1];
/*PHP正則替換圖片img標記中的任意屬性*/
//1、將src="/uploads/images/20100516000.jpg"替換為src="/uploads/uc/images/20100516000.jpg")
print preg_replace('/(<img.+src=\"?.+)(images\/)(.+\.(jpg|gif|bmp|bnp|png)\"?.+>)/i',"\${1}uc/images/\${3}",$str);
echo "<hr/>";
//2、將src="/uploads/images/20100516000.jpg"替換為src="/uploads/uc/images/20100516000.jpg",並省去寬和高
print preg_replace('/(<img).+(src=\"?.+)images\/(.+\.(jpg|gif|bmp|bnp|png)\"?).+>/i',"\${1} \${2}uc/images/\${3}>",$str);
?>

Ⅳ 如何在html文件里寫php程序

可以使用<?php ?>將php語句包含,然後將html格式改為php。

1、新建html文檔並使用html模板生成必要元素,然後在body標簽中添加一段文字:

熱點內容
java深入學習 發布:2025-07-15 10:13:50 瀏覽:534
linux應用程序開發pdf 發布:2025-07-15 10:11:37 瀏覽:911
解壓冷知識 發布:2025-07-15 10:11:35 瀏覽:78
outlook郵件的伺服器是什麼 發布:2025-07-15 09:45:59 瀏覽:482
如何安排資產配置 發布:2025-07-15 09:33:24 瀏覽:906
更新傳送伺服器目的地址失敗 發布:2025-07-15 09:27:05 瀏覽:484
c語言else的用法 發布:2025-07-15 09:19:54 瀏覽:119
tnt蘋果核安卓怎麼加好友 發布:2025-07-15 09:05:15 瀏覽:239
年輕人運行內存為什麼比安卓好 發布:2025-07-15 08:52:03 瀏覽:515
怎麼配置組策略 發布:2025-07-15 08:52:02 瀏覽:246