php随笔

1 redirect注意 301 302是不同的,301永久跳转,不影响排名

     if($count<1){
               Header("HTTP/1.1 301 Moved Permanently");
               Header("Location: /cp?q=".$q);
               die();
     } 

2 中文编码

if(mb_detect_encoding($_REQUEST['q'])=='ASCII'){
  //对应form提交编码 js encodeURIComponent
  $_REQUEST['q']=urldecode($_REQUEST['q']);
 }
 php的urlencode无需再urldecode

3 php webservice取数据

  两边md5加密结果有时不同导致返回数据为空,所以一般最好返回时不做md5的验证,or some other better function

原文地址:https://www.cnblogs.com/ai464068163/p/2600550.html