欧美成人午夜免费全部完,亚洲午夜福利精品久久,а√最新版在线天堂,另类亚洲综合区图片小说区,亚洲欧美日韩精品色xxx

扣丁學堂PHP培訓簡述yii2 url重寫并隱藏index.php方法

2019-03-19 10:32:18 2374瀏覽

PHP開發(fā)技術已經(jīng)被越來越多的人所喜愛,所以現(xiàn)在參加PHP培訓的人也在不斷的增加,本篇文章小編給大家分享一下yii2 url重寫并隱藏index.php方法,對PHP開發(fā)技術感興趣或者是想要學習PHP開發(fā)技術的小伙伴就隨小編一起來了解一下吧。



扣丁學堂PHP培訓簡述yii2 url重寫并隱藏index.php方法



第一步 : 不管是apache 還是nginx ,想要隱藏Index.php 文件,需要打開urlManager 組件的配置,在進行后續(xù)的操作:


[
‘components' => [
 'urlManager' => [
  'enablePrettyUrl' => true,//開啟美化URL
  'showScriptName' => false,//是否顯示腳本名稱:index.php,同時應該配置 Web 服務
  'enableStrictParsing' => false,//是否開啟嚴格解析
  //'suffix' => '.html',//生成帶 .html 后綴的 URL
  'rules' => [
    
   ],
  ],
],
]


第二步:


nginx下:


配置文件 nginx.conf 內容如下:


user centos;
worker_processes 4;
 
error_log logs/error.log;
 
pid    logs/nginx.pid;
 
 
events {
  worker_connections 10240;
}
 
 
http {
  include    mime.types;
  default_type application/octet-stream;
 
  log_format main '$remote_addr - $remote_user [$time_local] "$request" '
           '$status $body_bytes_sent "$http_referer" '
           '"$http_user_agent" "$http_x_forwarded_for"';
 
  log_format log_json '{ "@timestamp": "$time_local", '
            '"remote_addr": "$remote_addr", '
            '"referer": "$http_referer", '
            '"request": "$request", '
            '"status": $status, '
            '"bytes": $body_bytes_sent, '
            '"agent": "$http_user_agent", '
            '"x_forwarded": "$http_x_forwarded_for", '
            '"up_addr": "$upstream_addr",'
            '"up_host": "$upstream_http_host",'
            '"up_resp_time": "$upstream_response_time",'
            '"request_time": "$request_time"'
            ' }';
 
 
  access_log logs/access.log;
 
  sendfile    on;
  #tcp_nopush   on;
 
  #keepalive_timeout 0;
  keepalive_timeout 200;
    client_max_body_size 200M;
  gzip on;
 
    include vhost/*.conf;
}


項目域名的配置整體是放在 vhost 這個目錄下面,改目錄下其中一個文件的內容


server {
    listen 80;
    server_name   域名;
 
    # 項目 index.php 地址
    root /home/centos/www/youdai-api/bird/web;
 
    access_log logs/youdaiApi.access.log log_json;
    error_log logs/youdaiApi.error.log;
 
    location / {
        try_files $uri $uri/ /index.php?$args;
        index  index.php;
    }
 
    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
 
    location ~ /\.ht {
        deny all;
    }
}


apche 下:偽靜態(tài)配置


入口文件的同級目錄下,放置 .htaccess 文件


PHP學習

內容如下:


RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]


想要了解更多關于PHP開發(fā)方面內容的小伙伴,請關注扣丁學堂PHP培訓官網(wǎng)、微信等平臺,扣丁學堂IT職業(yè)在線學習教育有專業(yè)的PHP講師為您指導,此外扣丁學堂老師精心推出的PHP視頻教程定能讓你快速掌握PHP從入門到精通開發(fā)實戰(zhàn)技能。扣丁學堂PHP技術交流群:374332265。


扣丁學堂PHP培訓


【關注微信公眾號獲取更多學習資料】

 

 

查看更多關于“php培訓資訊”的相關文章>>




標簽: PHP培訓 PHP基礎教程 PHP學習視頻 PHP教學視頻 PHP入門教程 PHP教程視頻 PHP在線學習 PHP在線視頻 PHP在線教程 扣丁學堂PHP培訓

熱門專區(qū)

暫無熱門資訊

課程推薦

微信
微博
15311698296

全國免費咨詢熱線

郵箱:codingke@1000phone.com

官方群:148715490

北京千鋒互聯(lián)科技有限公司版權所有   北京市海淀區(qū)寶盛北里西區(qū)28號中關村智誠科創(chuàng)大廈4層
京ICP備2021002079號-2   Copyright ? 2017 - 2022
返回頂部 返回頂部