1.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();


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();
2.关于tp5无法隐藏入口文件
官网下的.htaccess文件:


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>
修改后:


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>