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
Php 无法从wordpress传递结果';s plugins\u url到str\u replace。获取错误:_Php_Wordpress - Fatal编程技术网

Php 无法从wordpress传递结果';s plugins\u url到str\u replace。获取错误:

Php 无法从wordpress传递结果';s plugins\u url到str\u replace。获取错误:,php,wordpress,Php,Wordpress,我将函数plugins\u url的结果放入一个变量中,并将其传递给str\u replace,但这会引发错误: Fatal error: Only variables can be passed by reference 我的代码: $baseURL = plugins_url( "somefile.php", dirname(__FILE__) ); //This throws an error $baseURL = str_replace( "something", "anothert

我将函数
plugins\u url
的结果放入一个变量中,并将其传递给
str\u replace
,但这会引发错误:

Fatal error: Only variables can be passed by reference
我的代码:

$baseURL = plugins_url( "somefile.php", dirname(__FILE__) );

//This throws an error
$baseURL = str_replace( "something", "anotherthing", $baseURL, 1 );

如何更改该函数的响应?

最后一个参数必须在变量中

$count = 1;
$baseURL = str_replace( "something", "anotherthing", $baseURL, $count );

非常感谢。我会在9分钟内把它标记为答案。@DonRhummy Cool,谢谢。这是一个奇怪的错误,实际上在其他地方也会出现,显然是由于现有的内存问题(其细节很难追踪),因此,虽然知道为什么我们必须这样做很好,但我想它必须足以知道该做什么。