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,分类名称,在售&分销数量\n"; 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 .= "\n"; } $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);}
这都是什么玩意呀???
<?php
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 "<p>Error socket IPv4: ".$errormsg."</p>\n" ;
}
else {
echo "<p>Socket IPv4 supported</p>\n" ;
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 "<p>Error socket IPv6: ".$errormsg."</p>\n" ;
}
else {
echo "<p>Socket IPv6 supported</p>\n" ;
socket_close($socket);
}
}
else echo "<p>Extension PHP sockets not loaded</p>\n" ;
?>