여기 내 설정이다 :Yii 색인 제거 - 무엇이 누락 되었습니까?
config.php를
'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>'
),
'showScriptName'=>false,
),
htaccess로 :
$this->widget('zii.widgets.CMenu',
array('items'=>
array(
array(
'label'=>Yii::t('site','A'),
'url'=>array('/site/index')
),
array(
'label'=>Yii::t('site','Q'),
'url'=>array('rooms/index')
),
array(
'label'=>Yii::t('site','G'),
'url'=>array('gastronomy/index')
),
array(
'label'=>Yii::t('site','A'),
'url'=>array('activity/index')
),
array(
'label'=>Yii::t('site','S'),
'url'=>array('services/index')
),
array(
'label'=>Yii::t('site','C'),
'url'=>array('contacts/index')
),
array(
'label'=>Yii::t('site','R'),
'url'=>array('booking/index')
)
)
)
);
: 레이아웃 메뉴에
Options +FollowSymlinks
#+FollowSymLinks must be enabled for any rules to work, this is a security
#requirement of the rewrite engine. Normally it's enabled in the root and we
#shouldn't have to add it, but it doesn't hurt to do so.
RewriteEngine on
#Apache scans all incoming URL requests, checks for matches in our
#.htaccess file
#and rewrites those matching URLs to whatever we specify.
#allow blank referrers.
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site.dev [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?dev.site.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]
# 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
나는이 있습니다
명시 적으로 여기를 호출하는 것이므로 명시 적으로 호출해야합니다. 이 설정으로
, I 예를 들어, 내가 할 그 링크를 클릭 할 때마다 :
W/아웃 지수 :
내가 얻을하고자하는 동안 이름.
무엇이 여기에 있습니까?
시간을내어 설명해 주셔서 감사합니다. 아니 행운 그러나. 새롭게 추가 된 라인이 정말로 필요합니까? Yii는 인덱스가 기본적으로 기본 컨트롤러를 가지고 있다고 정의하지 않습니까? - 내 말은, 그 라인을 추가했는데, 나는 여전히 URL과 같은 인덱스를 보았습니다. :( – MEM
@MEM 내가 당신에게 보여준 것과 동일한 순서? 규칙은 순서에서 중요합니다. 컨트롤러의 기본 동작은 호출에 사용되지만 URL 생성에는 사용되지 않습니다. URL 규칙 구성은 다른 곳에서는 이상한 것이 없으면 100 % 작동해야합니다. . – Johnatan
제공된대로 코드를 복사하여 복사했습니다. – MEM