English 中文(简体)
摘自Yi的URL
原标题:Rewriting a URL in Yii

我愿通过这一url www.example.com/detail/post

我应当能够处理这一术语,或者可以操作detail,其参数为post,或者处理一些带有一个名称的参数的行动:detail/code>和post

我读到了有关<代码>createUrl的Yi文件,但不能理解。

最佳回答

我认为,这是你回顾的:

更新主编。 php to the following (change controller in the part that states controller/detail to whatever the name of their controller is)

 urlManager  => array(
     urlFormat  =>  path ,
     showScriptName  => false,
     rules  => array(
             detail/<post:d+> => controller/detail ,
             <controller:w+>/<id:d+>  =>  <controller>/view ,
             <controller:w+>/<action:w+>/<id:d+>  =>  <controller>/<action> ,
             <controller:w+>/<action:w+>  =>  <controller>/<action> ,
     ),
),

因此,基本上,你告诉Yi说,任何形式细节/编号要求都将提交给你的控制员,使用“详细”行动,然后通过一个称为“职位”的变量。

问题回答

如果你篡改手工艺,希望把以下内容列入你本人的查阅档案中:

php_value upload_max_filesize 1M
DirectoryIndex index.php

Options +FollowSymlinks
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

在座标/座标上添加以下内容。 php file:

 showScriptName =>false,

将删除该指数。 网址:www.ohchr.org





相关问题
URL rewrite in IIS6 - Third party tools

I have collected the following api/sdk/whatever which provide modules for doing url rewriting in IIS 5/6/7. Some are free-open source and some require $. I haven t tried any of them. I would like to ...

Rewrite spring-security redirect URLs

I m trying to get Tuckey UrlRewriteFilter to tidy up URLs for my webapp. One problem I ve got is that when spring-security notices that an anonymous user is trying to access a protected resource it ...

ASP.NET Friendly URLs

In my research, I found 2 ways to do them. Both required modifications to the Application_BeginRequest procedure in the Global.Asax, where you would run your code to do the actual URL mapping (mine ...

Could I get by HttpModule the URL that contains * before?

My web-site is working under ASP.NET 3.5, IIS7, Integrated pipiline mode. My HttpModule is getting request to all resources, including URLs like this: http://my-site.com/address And I would support *...

Domains & Foreward Slash

This is rather difficult to explain so please bear with me. We will be hosting 4 websites on our server and the plan is to have each site sit under its own domain: site-a.com site-b.com sub1.site-b....

URL Mod-Rewrite

I currently have a working URL: http://example.com/security-services.php?service=fixed-camera-surveillance and then I have PHP say, $_REQUEST[ service ] to do some stuff... But I d like to ...