全球主机交流论坛

标题: php报错~Using $this when not in object context in [打印本页]

作者: javaluo    时间: 2011-4-15 23:07
标题: php报错~Using $this when not in object context in
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 编辑 ]
作者: gdtv    时间: 2011-4-15 23:09
没有上下文,无法解答
作者: 有个就好    时间: 2011-4-15 23:49
index.php文件劈头盖脸就来句 $this->....,你让PHP情何以堪啊?
作者: serverpoint    时间: 2011-4-16 00:27
提示: 作者被禁止或删除 内容自动屏蔽
作者: wdlth    时间: 2011-4-16 01:14
用zend studio看




欢迎光临 全球主机交流论坛 (https://loc.1226.eu.org/) Powered by Discuz! X3.4