Ich habe Artikel in meiner Yii Web-Anwendung, ich möchte Artikel Titel statt ID an der URL anzeigen, ich habe diesen Link folgen: http://www.yiiframework.com/forum/index.php/topic/43874-urlmanager-show-title-instead-of-id/ i geändert createUrl Funktion sein:View Artikel Titel auf URL anstelle von ID in yii 1 Web-Anwendung für SEO hübsche URLs
Yii::app()->createUrl('home/article',array('id'=>$article->id,'title' => $article->title);
und die folgenden Regeln uRL Manager hinzufügen, wie unten:
'<action:\w+>'=>'home/<action>',
'<action:\w+>/<id:\d+>'=>'home/<action>',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
'article/<id>/<title>'=>'home/article/view/'
Artikel url jetzt mag: http://localhost/test/article?id=6 i wa nt zu sein
http://localhost/test/article/article-title
danke im voraus.
Ist Ihr Artikel Titel einzigartig oder was –
Nein tut es nicht. –