Php 无法通过引用将指定给重载对象
这是我的wordpress主题的一部分,它给了我最后一行代码的错误。 Iam在PHP5.4上运行wordpress 3.5.1Php 无法通过引用将指定给重载对象,php,wordpress,object,overloading,Php,Wordpress,Object,Overloading,这是我的wordpress主题的一部分,它给了我最后一行代码的错误。 Iam在PHP5.4上运行wordpress 3.5.1 Fatal error: Cannot assign by reference to overloaded object in C:\server\htdocs\web\digitalnak\wp-content\themes\rework\framework\php\PeTheme\PeThemeGallery.php on line 234 这是代码 $post
Fatal error: Cannot assign by reference to overloaded object in C:\server\htdocs\web\digitalnak\wp-content\themes\rework\framework\php\PeTheme\PeThemeGallery.php on line 234
这是代码
$post =& get_post($id);
if (!$post ) return $post;
$null = null;
if ($post->post_type != "gallery") return $null;
$meta =& $this->master->meta->get($id,$post->post_type);
$post->meta =& $meta;
在没有看过任何东西的情况下——因此这可能根本不起作用——尝试以下方法:
$post =& get_post($id);
if (!$post ) return $post;
$null = null;
if ($post->post_type != "gallery") return $null;
$meta =& $this->master->meta->get($id,$post->post_type);
$post->meta = $meta;
看起来您正在通过引用为ArrayAccess对象赋值。这在某些版本的PHP中不起作用。我无法判断这一点,但这段代码似乎非常频繁地使用了pass-by-reference,可能超出了需要。哪一行是第234行?您正在运行什么版本的PHP?你的主题是什么?什么版本的Wordpress?234是$post->meta=&$meta,我有php版本5.4和Wordpress版本3.5.1什么类型的对象是
$post
?