php 學習記錄:

1.php異常處理:php

 1 <?php
 2 header("content-type: text/html; charset=utf8");
 3 
 4 function at(){
 5     try{
 6         echo '異常處理 --->';
 7         throw new Exception('發生異常!aa');
 8     }catch(Exception $e){
 9         echo '鋪貨異常:'.$e->getMessage();
10     }
11 }
12 
13 at();
View Code
 1 <?php
 2 header("content-type: text/html; charset=utf8");
 3 
 4 function at(){
 5     try{
 6         echo '異常處理 --->';
 7         throw new \Exception('發生異常!aa');
 8     }catch(\Exception $e){
 9         echo '鋪貨異常:'.$e->getMessage();
10     }
11 }
12 
13 at();
View Code

 2.關於tp5沒法隱藏入口文件html

官網下的.htaccess文件:iview

1 <IfModule mod_rewrite.c>
2   Options +FollowSymlinks -Multiviews
3   RewriteEngine On
4 
5   RewriteCond %{REQUEST_FILENAME} !-d
6   RewriteCond %{REQUEST_FILENAME} !-f
7   RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
8 </IfModule>
View Code

修改後:ide

1 <IfModule mod_rewrite.c>
2   Options +FollowSymlinks -Multiviews
3   RewriteEngine On
4 
5   RewriteCond %{REQUEST_FILENAME} !-d
6   RewriteCond %{REQUEST_FILENAME} !-f
7   RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
8 </IfModule>
View Code
相關文章
相關標籤/搜索