Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用CHtml::link时出现输入脚本_Php_Yii - Fatal编程技术网

Php 使用CHtml::link时出现输入脚本

Php 使用CHtml::link时出现输入脚本,php,yii,Php,Yii,我在和易玩。 我使用.htaccess和main配置删除了URL中存在的条目脚本,但在使用CHtml::links()时,它再次出现。我怎样才能修好它? 例如: <?php echo CHtml::link(CHtml::encode($data->id), array('view', 'id'=>$data->id)); ?> 更新: 我的urlManager配置: 'urlManager'=>array( 'urlFormat'=&g

我在和易玩。 我使用.htaccess和main配置删除了URL中存在的条目脚本,但在使用CHtml::links()时,它再次出现。我怎样才能修好它? 例如:

<?php echo CHtml::link(CHtml::encode($data->id), array('view', 'id'=>$data->id)); ?>

更新: 我的urlManager配置:

'urlManager'=>array(
        'urlFormat'=>'path',
        'rules'=>array(
        '<controller:\w+>/<id:\d+>'=>'<controller>/view',
        '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
        '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
        'commentfeed'=>array('comment/feed','urlSuffix'=>'.xml', 'caseSensitive'=>false),
        'showScriptName'=>false,
        'caseSensitive'=>false,
        '<pid:\d+>/commentfeed'=>array('comment/feed','urlSuffix'=>'.xml', 'caseSensitive'=>false),
        ),
'urlManager'=>数组(
“urlFormat'=>“路径”,
'规则'=>数组(
“/”=>“/视图”,
'//'=>'/',
'/'=>'/',
'commentfeed'=>array('comment/feed','urlSuffix'=>'.xml','caseSensitive'=>false),
'showScriptName'=>false,
“区分大小写”=>错误,
'/commentfeed'=>array('comment/feed','urlSuffix'=>'.xml','caseSensitive'=>false),
),
我的.htaccess

Options +FollowSymLinks
IndexIgnore */*
<IfModule mod_rewrite.c>
RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php
</IfModule>
Options+FollowSymLinks
IndexIgnore*/*
重新启动发动机
#如果存在目录或文件,请直接使用它
重写cond%{REQUEST_FILENAME}!-f
重写cond%{REQUEST_FILENAME}!-d
#否则将其转发到index.php
RewriteRule.index.php

必须在配置文件中将showEntryScript设置为false

请按照框架的官方说明进行操作:

这是正确的答案,但链接页面实际上并没有确切地显示如何做到这一点。即使这样做了,因为答案很简单,所以最好在这里有答案。在答案中包含这些信息将使其从有用变为优秀。虽然它没有在代码中显示,但在该页面ShowEntryScrip上有说明t为false,如果不是false,则到处都会出现输入纸条,但正如我所提到的,问题就在我使用CHtml::link()时。我完全使用Yii的文档设置了我的配置。我认为需要对使用CHtml::link进行更改,但我不知道是什么。