...
|
...
|
@@ -29,50 +29,7 @@ class IndexController extends HomeBaseController |
|
|
|
|
|
*/
|
|
|
public function index(){
|
|
|
// 建立socket连接到内部推送端口
|
|
|
$client = stream_socket_client('tcp://127.0.0.1:5678', $errno, $errmsg, 1);
|
|
|
// 推送的数据,包含uid字段,表示是给这个uid推送
|
|
|
$data = array('uid'=>'uid1', 'percent'=>'88%','user'=>'panhaowen');
|
|
|
// 发送数据,注意5678端口是Text协议的端口,Text协议需要在数据末尾加上换行符
|
|
|
fwrite($client, json_encode($data)."\n");
|
|
|
// 读取推送结果
|
|
|
// echo fread($client, 8192);
|
|
|
return $this->fetch(':index');
|
|
|
}
|
|
|
|
|
|
|
|
|
public function index2(){
|
|
|
$url = './1111.xlsx';
|
|
|
|
|
|
|
|
|
|
|
|
//分析文件获取后缀判断是2007版本还是2003
|
|
|
$extend = pathinfo($url);
|
|
|
$extend = strtolower($extend["extension"]);
|
|
|
// 判断xlsx版本,如果是xlsx的就是2007版本的,否则就是2003
|
|
|
if ($extend == "xlsx") {
|
|
|
$PHPReader = new \PHPExcel_Reader_Excel2007();
|
|
|
$PHPExcel = $PHPReader->load($url);
|
|
|
} else {
|
|
|
$PHPReader = new \PHPExcel_Reader_Excel5();
|
|
|
$PHPExcel = $PHPReader->load($url);
|
|
|
}
|
|
|
|
|
|
$objWorksheet = $PHPExcel->getActiveSheet();
|
|
|
$highestRow = $objWorksheet->getHighestRow();
|
|
|
|
|
|
$highestColumn = $objWorksheet->getHighestColumn();
|
|
|
$highestColumnIndex = \PHPExcel_Cell::columnIndexFromString($highestColumn);//总列数
|
|
|
|
|
|
$headtitle = array();
|
|
|
for ($row = 1; $row <= $highestRow; $row++) {
|
|
|
|
|
|
//注意highestColumnIndex的列数索引从0开始
|
|
|
for ($col = 0; $col < $highestColumnIndex; $col++) {
|
|
|
$headtitle[$row][$col] = $objWorksheet->getCellByColumnAndRow($col, $row)->getValue();
|
|
|
}
|
|
|
}
|
|
|
var_dump($headtitle);
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|