vim /etc/php.ini
cgi.fix_pathinfo = 1 #将注释去掉
httpd.conf
根目录 .htaccess
<IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine On RewriteCond %{
REQUEST_FILENAME} !-d RewriteCond %{
REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L] </IfModule>
tp5 app/route.php
//引入系统类 use think\Route; Route::rule([ '/'=>'index/index/index', 'news'=>'index/news/index', // 如果隐藏id的话 // 'detail-:id'=>'index/news/detail', ],'','get|post'); Route::rule('detail/:id','index/news/detail','get');
前端界面
<a href="{:url('/detail/5')}">新闻-{
$v}</a>

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/219341.html原文链接:https://javaforall.net
