• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

PHP框架queryphp教程:入门九 怎么去掉index.php

php 搞代码 3年前 (2022-01-24) 24次浏览 已收录 0个评论

PHP框架queryphp教程:入门九 如何去掉index.php

Order allow,deny

Allow from all

AllowOverride FileInfo?

?

DocumentRoot “D:/work”

ServerName “www.app.com”

.htaccess文件 放在project目录下面 就是每个项目目录下面,这样就会访问同级目录

index.php文件

index.php 目录下.htaccess文件:

RewriteEngine On

?

# uncomment the following line, if you are having trouble

# getting no_script_name to work

#RewriteBase /

?

# we skip all files with .something

#RewriteCond %{REQUEST_URI} \..+$

#RewriteCond %{REQUEST_URI} !\.html$

#RewriteRule .* – [L]

?

# we check if the .html version is here (caching)

RewriteRule ^$ index.html [QSA]

RewriteRule ^([^.]+)$ $1.html [QSA]

RewriteCond %{REQUEST_FILENAME} !-f

?

# no, so we redirect to our front web controller

RewriteRule ^(.*)$ index.php [QSA,L]

————————

程序中使用url_for()方式

模板中示示例 我们还是以CURD方式?

“>编辑

“>删除

下载后在并在apache设置www.6来源gaodaimacom搞#^代%!码网搞gaodaima代码app.com 在c:/windows/system

http://www.tjwzjs.cn/queryphp/project/curd/index

是不是可以显示内容了

如果显示了 在framework\config\inc.ini.php 文件中把下面这行内容去掉注释

//$config[‘html’]=’.html’;//开启.html结尾url

http://www.tjwzjs.cn/queryphp/project/curd/index.html 访问

是不是可以看到内容了

所有链接都带.html结尾了。那我们有时候想不要.html结尾怎么办

“>删除

url_for(url,true);方式 表示不要html结尾

删除会变成这样子

http://www.tjwzjs.cn/queryphp/project/curd/delete/id/2?

原文来源:http://tjwzjs.cn/news/knowledge/2012/1210/56.html


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:PHP框架queryphp教程:入门九 怎么去掉index.php

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址