这是我的wordpress主题的一部分,它给了我最后一行代码的错误。我在PHP 5.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 =& 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;
发布于 2013-04-18 16:00:15
在没有看过任何东西的情况下--因此这可能根本不起作用--试试这个:
$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中不起作用。我不能判断这一点,但看起来这段代码使用了大量的按引用传递,可能超过了需要的程度。
https://stackoverflow.com/questions/15555418
复制相似问题