Subversion Repositories qbpwcf-lib(archive)

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
828 liveuser 1
<?php
2
 
3
#使用命名空間qbpwcf
4
namespace qbpwcf;
5
 
6
#assets dir
7
$assetsDir="assets of cmd::getArgu_20241204-1";
8
 
9
#get test data
10
$_GET["gn"]="gv";
11
 
12
#post test data
13
$_POST["pn"]="pv";
14
 
15
#函式說明:
16
#抓取命令列的參數.
17
#回傳結果:
18
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
19
#$reuslt["error"],執行不正常結束的錯訊息陣列.
20
#$result["function"],當前執行的函式名稱.
21
#$result["argu"],使用的參數陣列.
22
#$result["content"],要回傳的參數陣列.
23
#$result["count"],參數的數量.
24
#$result["_GET"],收到的 HTTP GET 參數陣列.
25
#$result["_POST"],收到的 HTTP POST 參數陣列.
26
#必填參數:
27
#無
28
#可省略參數:
29
#$conf["echo"],字串,"true"代表要將抓到的參數一個個印出來,"false"代表用回傳的方式,預設為"false".
30
#$conf["echo"]="false";
31
#$conf["httpGetToArgu"],字串,"true"代表要將 http get 參數變成參數來取得,像是 $_GET["p1"] 會變成 $result["content"]["p1"] 回傳,預設為"false"代表不使用.
32
$conf["httpGetToArgu"]="true";
33
#$conf["httpPostToArgu"],字串,"true"代表要將 http post 參數變成參數來取得,像是 $_POST["p1"] 會變成 $result["content"]["p1"] 回傳,預設為"false"代表不使用.
34
$conf["httpPostToArgu"]="true";
35
#參考資料:
36
#無.
37
#備註:
38
#無.
39
$getArgu=cmd::getArgu($conf);
40
unset($conf);
41
 
42
#如果執行失敗
43
if($getArgu["status"]==="false"){
44
 
45
	#函式說明:
46
	#撰寫log
47
	#回傳結果:
48
	#$result["status"],狀態,"true"或"false".
49
	#$result["error"],錯誤訊息陣列.
50
	#$result["function"],當前函式的名稱.
51
	#$result["argu"],使用的參數.
52
	#必填參數:
53
	#$conf["path"],字串,log檔案的路徑與名稱.
54
	$conf["path"]=$logFile;
55
	#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
56
	$conf["content"]=$getArgu;
57
	#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
58
	$conf["fileArgu"]=__FILE__;
59
	#可省略參數:
60
	#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
61
	#$conf["rewrite"]="false";
62
	#參考資料:
63
	#無.
64
	#備註:
65
	#無.
66
	$record=logs::record($conf);
67
	unset($conf);
68
 
69
	#如果寫log失敗
70
	if($record["status"]==="false"){
71
 
72
		#印出結果
73
		var_dump($record);
74
 
75
		}#if end
76
 
77
	#結束執行,回傳錯誤代碼1
78
	exit(1);
79
 
80
	}#if end
81
 
82
#顯示結果
83
var_dump($getArgu);