Blame | Last modification | View Log | RSS feed
<?php#使用命名空間qbpwcfnamespace qbpwcf;#匯入外部套件include("../allInOneForJson.php");/*#提示要測試的套件echo "<hr>logs::parseHtmlStr & logs::filterMsgPack - testCase 1<br>";#函式說明:#解析讀取到的log內容,分段成數個訊息儲存到session陣列中並回傳完整的訊息部分.訊息內容的特徵為有為開頭關鍵字出現則為一個訊息的開始.#回傳結果:#$result["status"],狀態,"true"或"false".#$result["error"],錯誤訊息陣列.#$result["function"],當前函式的名稱.#$result["argu"],使用的參數.#必填參數:#$conf["path"],log檔案的路徑與名稱.$conf["path"]="fileAccessT/Devcom.log";#$conf["msgStart"],字串,要寫的內容.#$conf["msgStart"]="i UdpS, ".date('n')."/".date('j');$conf["msgStart"]="i UdpS, 1/12";#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑$conf["fileArgu"]=__FILE__;#可省略參數:#$conf["sessionName"],字串,儲存log的session變數key.#$conf["sessionName"]="";#$conf["line2start"],字串,log從第幾列開始,預設為總行數減去linesPerTime+1.$conf["line2start"]="0";#$conf["linesPerTime"],字串,一次最多讀取幾列,預設爲10列.$conf["linesPerTime"]="100";$parseSessionLog=logs::parseLog2session($conf);unset($conf);#如果執行錯誤if($parseSessionLog["status"]==="false"){#印出結果var_dump($parseSessionLog);#結束執行exit;}#if end#函式說明:#解析多個訊息陣列,尋找有關鍵字出現的訊息,並回傳之.#回傳結果:#$result["status"],狀態,"true"或"false".#$result["error"],錯誤訊息陣列.#$result["function"],當前函式的名稱.#$result["argu"],使用的參數.#$result["content"],陣列,有開頭關鍵字出現的訊息陣列.#必填參數:#$conf["msgs"],陣列,由多個訊息陣列組成.$conf["msgs"]=$parseSessionLog["content"];#$conf["keyWord"],陣列,每個關鍵字.$conf["keyWord"]=array("2","3","E","D");#$conf["keyWordAddr"],陣列,關鍵字的位置是第幾個.$conf["keyWordAddr"]=array("21","22","24","25");#可省略參數:#無$filterMsgPack=logs::filterMsgPack($conf);unset($conf);#如果執行錯誤if($filterMsgPack["status"]==="false"){#印出結果var_dump($filterMsgPack);#結束執行exit;}#if end#輸出結果var_dump($filterMsgPack);*//*#提示要測試的套件echo "<hr>logs::parseLog2sessionWithMultiMsgStartSupport & logs::filterMsgPackWithMultiKeywordSupport - testCase 1<br>";#函式說明:#解析讀取到的log內容,分段成數個訊息(可以有多種)儲存到session陣列中並回傳完整的訊息部分.#回傳結果:#$result["status"],狀態,"true"或"false".#$result["error"],錯誤訊息陣列.#$result["function"],當前函式的名稱.#$result["argu"],使用的參數.#$result["content"],陣列,每個有關鍵字的訊息陣列.#$result["lineNun"],數字,當前行數.#必填參數:#$conf["path"],log檔案的路徑與名稱.$conf["path"]="fileAccessT/Devcom.log";#$conf["msgStart"],字串陣列,用來識別訊息開頭的開頭關鍵字,支援多種訊息的開頭.#$conf["msgStart"]=array("i UdpS, ".date('n')."/".date('j'),"i TcpSvr, ".date('n')."/".date('j'));$conf["msgStart"]=array("i UdpS, 1/9","i TcpSvr, 1/9");#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑$conf["fileArgu"]=__FILE__;#可省略參數:#$conf["sessionName"],字串,儲存log的session變數key.#$conf["sessionName"]="";#$conf["line2start"],字串,log從第幾列開始,預設為總行數減去linesPerTime+1.$conf["line2start"]="23600";#$conf["linesPerTime"],字串,一次最多讀取幾列,預設爲10列.$conf["linesPerTime"]="200";$parseLog2sessionWithMultiMsgStartSupport=logs::parseLog2sessionWithMultiMsgStartSupport($conf);unset($conf);#如果執行錯誤if($parseLog2sessionWithMultiMsgStartSupport["status"]==="false"){#印出結果var_dump($parseLog2sessionWithMultiMsgStartSupport);#結束執行exit;}#if end#函式說明:#解析多個訊息陣列,尋找符合其中一組關鍵字出現的訊息,並回傳之.#回傳結果:#$result["status"],狀態,"true"或"false".#$result["error"],錯誤訊息陣列.#$result["function"],當前函式的名稱.#$result["argu"],使用的參數.#$result["content"],陣列,有開頭關鍵字出現的訊息陣列.#必填參數:#$conf["msgs"],陣列,由多個訊息陣列組成.$conf["msgs"]=$parseLog2sessionWithMultiMsgStartSupport["content"];#$conf["keyWords"],二維陣列,每個關鍵字.$conf["keyWords"]=array(array("2","3","E","D"),array("i"," ","T","c","p","S","v","r"));#$conf["keyWordsAddr"],二維陣列,關鍵字的位置是第幾個.$conf["keyWordsAddr"]=array(array("21","22","24","25"),array("0","1","2","3","4","5","6","7"));#可省略參數:#無$filterMsgPackWithMultiKeywordSupport=logs::filterMsgPackWithMultiKeywordSupport($conf);unset($conf);#如果執行錯誤if($filterMsgPackWithMultiKeywordSupport["status"]==="false"){#印出結果var_dump($filterMsgPackWithMultiKeywordSupport);#結束執行exit;}#if endecho "<pre>";print_r($filterMsgPackWithMultiKeywordSupport["content"]);echo "</pre>";*//*#提示要測試的套件#echo "<hr>logs::parseLog2sessionWithMultiMsgStartSupport & logs::filterMsgPackWithMultiKeywordSupport - testCase 2<br>";#函式說明:#建立qbpwcf專屬的js函式庫#回傳結果#$result["funciton"],當前函式的名稱.#$result["status"],執行的狀態,"true"代表正常,"false"代表不正常.#$result["error"],錯誤訊息#$result["content"],語法.echo javaScript::qbpwcfJavaScript()["content"];#函式說明:#傳遞識別數字進而取得連續的資料#回傳結果:#$result["status"],執行正常與否,"true"代表正常,"false"代表不正常.#$result["error"],錯誤訊息.#$result["function"],當前執行的函式名稱.#$result["content"],js語法.#必填參數:#$conf["params"],參數陣列,要傳遞的識別參數.$conf["params"]=array("lineStart"=>1);#$conf["url"],字串,要從哪個頁面要求連續的資料.$conf["url"]="logsT2.php";#可省略參數:#$conf["method"],字串,資料傳輸的方式,有POST跟GET$conf["method"]="POST";#$conf["responseDivId"],字串,放置取得資料div的id.$conf["responseDivId"]="rootDiv";$tailAny=javaScript::tailAny($conf);unset($conf);#如果執行錯誤if($tailAny["status"]==="false"){#印出結果var_dump($tailAny);#結束執行exit;}#if end#印出 js 語法echo $tailAny["content"];#印出 root divecho "<div id='rootDiv'></div>";*/?>