php工作笔记

取两位小数:$temp=sprintf("%0.2f",($r[tprice]-$r[buyfen]));
向上求整:$pageCount=ceil($recordCount/$perCount);//总页数



时间秒数转换为时间格式:$newstime=date('Y-m-d', $d[newstime]);


替换:$saytext=str_replace("\n","</br>",$_POST['saytext']);//答案内容

获取网站根目录:$root="http://".$_SERVER['HTTP_HOST']."/";//根目录

字符串->数组:
$fexp="::::::";
$rr=explode(";",$domain);
$count=count($rr);
  for($i=0;$i<$count;$i++)
   {
$fr=explode($fexp,$rr[$i]);
$serverno=$fr[0]; //区号
$servername=$fr[1];//名称
   .......
    }    

你可能感兴趣的:(工作,PHP)