preg_match("/<h1>([\s\S]*?)<\/h1>/i",$data, $matches);echo trim($matches[1]);
可以成功获取到<h1>标签内容
现在我的网页是<h1 style="text-align:center;">内容</h1>该怎么写呢?
谢谢了!
可以成功获取到<h1>标签内容
现在我的网页是<h1 style="text-align:center;">内容</h1>该怎么写呢?
谢谢了!
调试欢乐多
echo trim($matches[1]);
echo trim($matches[1]);online demo: http://sandbox.onlinephpfunctions.com/code/ab4bdaccb32d9d929e6d433bacdb80d20c6eed9b