CakePHP错误:语法错误,意外T_STRING,期待','或';'

时间:2013-11-26 11:58:32

标签: .htaccess cakephp cakephp-2.0 cakephp-2.3 cakephp-appmodel

我收到语法错误注释代码。 有些人可能有想法,为什么会出现这个错误

错误:语法错误,意外T_STRING,期待','或';' redmine / app / View / Welcome / index.ctp Line:4

<h2><?php $this->Candy->html_title(__('Home'))  ?></h2>

<div class="splitcontentleft">
<!-- <%= textilizable Setting.welcome_text %> -->
<?php echo $this->Candy->textilizable($Settings->welcome_text) ?>
<?php if (!empty($news)): ?>
<div class="box">
<h3><?php echo __('Latest news')?></h3>
    <?php echo $this->element('news',array('news' => $news)) ?>
    <?php echo $this->Html->link(__('View all news'), array('controller' =>    
'news')) ?>
</div>
<?php endif; ?>
</div>

它在localhost中工作正常,这似乎是.htaccess文件问题?

提前致谢... !!!

3 个答案:

答案 0 :(得分:1)

我相信你的标题中缺少回音。像这样使用它:

<h2><?php echo $this->Candy->html_title(__('Home')); ?></h2>

答案 1 :(得分:0)

如果您启用了asp_tags,则无论在html中注释的事实,都会处理php脚本。只需剥去它&lt;%=和%&gt;它应该工作。

如果这样的脚本会响应任何内容,它将被html评论但仍由PHP处理。

答案 2 :(得分:0)

您在asp_tagsphp.ini了,这就是您收到此错误的原因。

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' 

您可以在asp_tags中停用.htaccess

php_flag asp_tags off

如果你想只为一个文件禁用它,你可以使用这个

<files file-with-asp-syntax.php>php_flag asp_tags off</files>

您也可以使用此ini_set('asp_tags', 0)