今天本地测试ecshop,后台操作站点地图是报如下错误:
Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\ecshop\admin\sitemap.php on line 46
Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\ecshop\admin\sitemap.php on line 47
Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\ecshop\admin\sitemap.php on line 68
Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\ecshop\admin\sitemap.php on line 79
Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\ecshop\admin\sitemap.php on line 90
Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\ecshop\admin\sitemap.php on line 102
于是百度了一下,发现好多童鞋出现这个问题,原来是PHP 5.3 中直接可以使用“=”,已经弃用了“=&”。再定位错误行发现,每一行都有"=&",于是将所有的“=&”都替换成“=”,问题得到解决。
$sm =& new google_sitemap();
$smi =& new google_sitemap_item($domain, $today, $_POST['homepage_changefreq'], $_POST['homepage_priority']);
后记:
2022-01-16 整理博客记
回头看以前写的东西,不禁发笑,都是啥玩意?
这个问题其实并不是原来是PHP 5.3 中直接可以使用“=”,已经弃用了“=&”
,当时瞎猫碰上死耗子,百度胡乱搜,不知道看文档,只是碰巧把问题解决了。
真实原因 PHP 手册里面写的很清楚: