//記錄返回值
? ? ? ? $write_data_a = [
? ? ? ? ? ? 'html_url'? =>? $getUrl,
? ? ? ? ? ? 'ip'? ? => $this->get_real_ip(),
? ? ? ? ? ? 'time'? =>? date("Y-m-d H:i:s",time()),
? ? ? ? ? ? 'res'?? => $response
? ? ? ? ];
//轉(zhuǎn)化為JSON
? ? ? ? $write_data_a = json_encode($write_data_a) . '||' . "\n";
? ? ? ? $date = date("Y-m-d", time());
//項(xiàng)目路徑目錄萄焦,判斷是否存在,不存在則創(chuàng)建
? ? ? ? $lujing = "./360_mobile_res_sd";
? ? ? ? if(!is_dir($lujing)){
? ? ? ? ? ? mkdir(iconv("UTF-8", "GBK", $lujing),0777,true);
? ? ? ? }
//文件,判斷是否存在披坏,不存在則創(chuàng)建
? ? ? ? $TxtFileName = "./360_mobile_res_sd/" . $date . "_2.txt";
? ? ? ? //以讀寫方式打?qū)懼付ㄎ募涔啵绻募淮鎰t創(chuàng)建
? ? ? ? if(file_exists($TxtFileName))
? ? ? ? {
//存在,追加寫入內(nèi)容
? ? ? ? ? ? file_put_contents($TxtFileName, $write_data_a, FILE_APPEND);
? ? ? ? }
? ? ? ? else
? ? ? ? {
//不存在怪与,創(chuàng)建并寫入
? ? ? ? ? ? if( ($TxtRes=fopen ($TxtFileName,"w+")) === FALSE){
? ? ? ? ? ? ? ? exit();
? ? ? ? ? ? }
? ? ? ? ? ? if(!fwrite ($TxtRes,$write_data_a)){ //將信息寫入文件
? ? ? ? ? ? ? ? fclose($TxtRes);
? ? ? ? ? ? ? ? exit();
? ? ? ? ? ? }
? ? ? ? ? ? fclose ($TxtRes); //關(guān)閉指針
? ? ? ? }