日常使用
截取替换
$bank_num= 1234567891231496;
substr_replace($bank_num, '*****', 6, 8)
$bank_num是整数,'*****'替换内容,6是开始位数,8是替换个数
floatval用于获取变量的浮点值。
$var = '122.34343runoob';
$float_value_of_var = floatval ($var);
echo $float_value_of_var;
122.34343
explode(',', $list['hk_img']);数组转字符串
php 抓取页面内容
$html = file_get_contents($url); //如果出现中文乱码使用下面代码 //$getcontent = iconv("gb2312", "utf-8",$html); echo "<textarea style='width:800px;height:600px;'>".$html."</textarea>"; $ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);$html = curl_exec($ch);curl_close($ch);echo "<textarea style='width:800px;height:600px;'>".$html."</textarea>";

浙公网安备 33010602011771号