javaluo 发表于 2011-4-15 23:07:32

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:40

没有上下文,无法解答

有个就好 发表于 2011-4-15 23:49:15

index.php文件劈头盖脸就来句 $this->....,你让PHP情何以堪啊?

serverpoint 发表于 2011-4-16 00:27:09

wdlth 发表于 2011-4-16 01:14:25

用zend studio看
页: [1]
查看完整版本: php报错~Using $this when not in object context in