Php 使用str\u替换为文件\u获取\u内容
我正在使用file_get_contents抓取一个页面,但在回显页面之前,我需要替换页面内容中的一些数据 到目前为止我已经有了这个(这个脚本在domain2.com上运行) 并将其替换为Php 使用str\u替换为文件\u获取\u内容,php,Php,我正在使用file_get_contents抓取一个页面,但在回显页面之前,我需要替换页面内容中的一些数据 到目前为止我已经有了这个(这个脚本在domain2.com上运行) 并将其替换为 href="http://www.domain.com/ 但它不起作用。有什么线索吗?由于引号不同,您需要使用正则表达式(preg_替换)或两个str_替换。由于引号不同,您需要使用正则表达式(preg_替换)或两个str_替换。修复了它 $pagefixed = str_replace("href=\"/
href="http://www.domain.com/
但它不起作用。有什么线索吗?由于引号不同,您需要使用正则表达式(preg_替换)或两个str_替换。由于引号不同,您需要使用正则表达式(preg_替换)或两个str_替换。修复了它
$pagefixed = str_replace("href=\"/","href=\"http://www.domain.com/","$page");
谢谢大家修复了它
$pagefixed = str_replace("href=\"/","href=\"http://www.domain.com/","$page");
谢谢大家我删除了我的答案,因为如果执行的话会有很多问题。我删除了我的答案,因为如果执行的话会有很多问题。
href="http://www.domain.com/
$pagefixed = str_replace("href=\"/","href=\"http://www.domain.com/","$page");