Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php str_replace用于将URL更改为wp内容文件夹_Php_Wordpress - Fatal编程技术网

Php str_replace用于将URL更改为wp内容文件夹

Php str_replace用于将URL更改为wp内容文件夹,php,wordpress,Php,Wordpress,我需要替换指向wp内容文件夹的URL以指向不同的域,但不更改设置或wp配置中的设置 我在函数中尝试了这一点: // Replace links $uri = "https://blog.example.com/"; $newuri = str_replace("https://blog.example.com/","https://www.example.com/blog/",$uri); 但它不起作用 有没有办法做到这一点?您的代码

我需要替换指向wp内容文件夹的URL以指向不同的域,但不更改设置或wp配置中的设置

我在函数中尝试了这一点:

// Replace links
$uri = "https://blog.example.com/";
$newuri = str_replace("https://blog.example.com/","https://www.example.com/blog/",$uri);
但它不起作用


有没有办法做到这一点?

您的代码没有问题,可能是因为SSL。URL以
http://...
但您正在尝试替换
https://...

您的代码运行良好:有趣。。。。这对我不起作用。。。html中指向资源的所有链接仍然指向……您如何在代码中使用该
$newuri