PHPCodeフォーマットのテスト
2056 ワード
public function cateExport(){ $this->getDoToken(); $mCateGory = M("GoodsCategory"); $cate_arr = $mCateGory->where("parent_id!=0")->select(); $mGoods = M('Goods'); $where['is_allow_agent'] = 1; $where['goods_status'] = 1; foreach ($cate_arr as $k => $v) { $where['cate_id'] = $v['cate_id']; $cate_arr[$k]['goods_count'] = $mGoods->where($where)->count(); } $str=「分類ID、分類名、販売&販売数量」;mySort($cate_arr, 'goods_count', 'DESC'); foreach ($cate_arr as $k => $v) { $v['cate_name'] = str_replace(',', '/', $v['cate_name']); $str .= "\t". $v['cate_id'] . ',' . $v['cate_name'] . ',' . $v['goods_count']; $str .= ""; } $filename = 'category_count' . date('YmdHis') . '.csv'; header("Content-type:text/csv"); header("Content-Disposition:attachment;filename=". $filename); header('Cache-Control:must-revalidate,post-check=0,pre-check=0'); header('Expires:0'); header('Pragma:public'); echo iconv("UTF-8", "gb2312//IGNORE", $str);}
これは何ですか??if (extension_loaded('sockets')) {//Create socket IPv4 $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) ; if($socket === false) { $errorcode = socket_last_error() ; $errormsg = socket_strerror($errorcode); echo "Error socket IPv4: ".$errormsg.""; } else { echo "Socket IPv4 supported"; socket_close($socket); }
これは何ですか??if (extension_loaded('sockets')) {//Create socket IPv4 $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) ; if($socket === false) { $errorcode = socket_last_error() ; $errormsg = socket_strerror($errorcode); echo "Error socket IPv4: ".$errormsg.""; } else { echo "Socket IPv4 supported"; socket_close($socket); }
//Create socket IPv6
$socket = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP) ;
if($socket === false) {
$errorcode = socket_last_error() ;
$errormsg = socket_strerror($errorcode);
echo "Error socket IPv6: ".$errormsg."
" ;
}
else {
echo "Socket IPv6 supported
" ;
socket_close($socket);
}
}
else echo "Extension PHP sockets not loaded
" ;
?>