Subversion Repositories php-qbpwcf

Rev

Rev 3 | Rev 226 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3 Rev 168
Line 66... Line 66...
66
 
66
 
67
#匯入外部套件
67
#匯入外部套件
68
include("allInOne.php");
68
include("allInOne.php");
69
 
69
 
70
#如果不存在要轉換成16進位的數值
70
#如果不存在要轉換成16進位的數值
71
if( !isset($_SERVER['argv'][1]) )
71
if( !isset($_SERVER['argv'][1]) ){
72
{
72
 
73
	#show help
73
	#show help
74
	help();
74
	help();
75
 
75
 
76
	#停止執行
76
	#停止執行
77
	exit;
77
	exit;
78
}
78
 
-
 
79
	}#if end
79
 
80
 
80
#如果第參數為 "help" 或 "-h"
81
#如果第參數為 "help" 或 "-h"
81
if( $_SERVER['argv'][1]==="help" || $_SERVER['argv'][1]==="-h" )
82
if( $_SERVER['argv'][1]==="help" || $_SERVER['argv'][1]==="-h" ){
82
{
83
 
83
	#show help
84
	#show help
84
	help();
85
	help();
85
 
86
 
86
	#停止執行
87
	#停止執行
87
	exit;
88
	exit;
88
 
89
 
89
}#if end
90
	}#if end
90
 
91
 
91
#如果參數不齊全
92
#如果參數不齊全
92
if(!isset($_SERVER['argv'][3]))
93
if(!isset($_SERVER['argv'][3])){
93
{
-
 
94
 
94
 
95
	#show help
95
	#show help
96
	help();
96
	help();
97
 
97
 
98
	#停止執行
98
	#停止執行
99
	exit;
99
	exit;
100
 
100
 
101
}#if end
101
	}#if end
102
 
102
 
103
#涵式說明:
103
#涵式說明:
104
#呼叫shell執行系統命令,並取得回傳的內容.
104
#呼叫shell執行系統命令,並取得回傳的內容.
105
#回傳的結果:
105
#回傳的結果:
106
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
106
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 153... Line 153...
153
#escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
153
#escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
154
$callShell=external::callShell($conf);
154
$callShell=external::callShell($conf);
155
unset($conf);
155
unset($conf);
156
 
156
 
157
#如果執行失敗
157
#如果執行失敗
158
if($callShell["status"]==="false")
158
if($callShell["status"]==="false"){
159
{
159
 
160
	#印出內容
160
	#印出內容
161
	var_dump($callShell);
161
	var_dump($callShell);
162
	
162
	
163
	#結束執行
163
	#結束執行
164
	exit;
164
	exit;
165
}
165
 
-
 
166
	}#if end
166
 
167
 
167
#針對每行輸出
168
#針對每行輸出
168
foreach($callShell["output"] as $line)
169
foreach($callShell["output"] as $line){
169
{
-
 
170
 
170
 
171
	#印出內容
171
	#印出內容
172
	echo $line.PHP_EOL;
172
	echo $line.PHP_EOL;
173
 
173
 
174
}#foreach end
174
	}#foreach end
175
 
175
 
176
#說明
176
#說明
177
function help()
177
function help(){
178
{
178
 
179
	#說明
179
	#說明
180
	echo $_SERVER['argv'][0]." lineStartPoint lineEndPoint file".PHP_EOL;
180
	echo $_SERVER['argv'][0]." lineStartPoint lineEndPoint file".PHP_EOL;
181
}
181
 
-
 
182
	}#function end
182
 
183
 
183
?>
184
?>