全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 3171|回复: 4

php报错~Using $this when not in object context in

[复制链接]
发表于 2011-4-15 23:07:32 | 显示全部楼层 |阅读模式
Fatal error: Using $this when not in object context in /home/wwwroot/www.bestwei.com/index.php on line 1

php头
<?php
/**
*模板
*/
$this->need('header.php');
?>
尝试了修改为 $this=need('header.php');
会出现Fatal error: Cannot re-assign $this in /home/wwwroot/www.bestwei.com/index.php on line 11




<?php $this->need('header.php');
?>

        <div class="m4go_category_bg">
        <div class="m4go_category">
        <div class="m4go_category_main">

        <div class="m4go_category_node" id="m4go_content">
    <?php if ($this->have()): ?>
        <?php while($this->next()): ?>
        <div class="m4go_cate_list m4go_cate_<?php $this->theId(); ?>">
                     <div class="m4go_cate_list_pic" style="background: url(<?php $this->options->themeUrl(''); ?>657x141/<?php $this->theId(); ?>.jpg) no-repeat 5px 5px ;"><div class="m4go_cate_list_border"><a href="<?php $this->permalink() ?>" title="<?php $this->title() ?>" class="m4go_cate_list_titlepic"></a></div></div>
                         <h2 class="m4go_cate_list_title" style="background: url(<?php $this->options->themeUrl(''); ?>600x50/<?php $this->theId(); ?>.png) no-repeat; "><a href="<?php $this->permalink() ?>" title="<?php $this->title() ?>"><?php $this->title() ?></a></h2>
                         <div class="m4go_cate_list_txt">
                         <?php $this->content('阅读剩余部分...'); ?>
                         <div class="clearfix"></div>
                         </div>

                </div>



[ 本帖最后由 javaluo 于 2011-4-15 23:14 编辑 ]
发表于 2011-4-15 23:09:40 | 显示全部楼层
没有上下文,无法解答
发表于 2011-4-15 23:49:15 | 显示全部楼层
index.php文件劈头盖脸就来句 $this->....,你让PHP情何以堪啊?
发表于 2011-4-16 00:27:09 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2011-4-16 01:14:25 | 显示全部楼层
用zend studio看
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-5-22 00:45 , Processed in 0.057326 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表