Subversion Repositories php-qbpwcf

Rev

Rev 3 | Rev 226 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 liveuser 1
#!/usr/bin/php
2
<?php 
3
 
4
/*
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
6
    Copyright (C) 2015~2024 Min-Jhin,Chen
7
 
8
    This file is part of QBPWCF.
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
12
    the Free Software Foundation, either version 3 of the License, or
13
    (at your option) any later version.
14
 
15
    QBPWCF is distributed in the hope that it will be useful,
16
    but WITHOUT ANY WARRANTY; without even the implied warranty of
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
    GNU General Public License for more details.
19
 
20
    You should have received a copy of the GNU General Public License
21
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.
22
 
23
*/
24
 
25
#宣告命名空間
26
namespace qbpwcf;
27
 
148 liveuser 28
#取得 lib folder
3 liveuser 29
exec("php -f ".escapeshellarg(pathinfo(__FILE__)["dirname"]."/libexec/folderOfUsrLib.php"),$output,$status);
30
 
31
#如果執行失敗
32
if($status!==0){
33
 
34
	#debug
35
	var_dump(__LINE__,$output);
36
 
37
	#結束執行,回傳shell 1.
38
	exit(1);
39
 
40
	}#if end
41
 
148 liveuser 42
#儲存 lib folder
3 liveuser 43
$folderOfUsrLib=$output[0];
44
 
45
#以該檔案的實際位置的 lib path 為 include path 首位
46
$output=array();
47
exec("cd ".escapeshellarg(pathinfo(__FILE__)["dirname"]."/../".$folderOfUsrLib."/qbpwcf").";pwd;",$output,$status);
48
 
49
#如果執行失敗
50
if($status!==0){
51
 
52
	#debug
53
	var_dump(__LINE__,$output);
54
 
55
	#結束執行,回傳shell 1.
56
	exit(1);
57
 
58
	}#if end
59
 
60
#設置 include path 
61
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
62
 
63
#匯入外部套件
64
include("allInOne.php");
65
 
66
#函式說明:
67
#抓取命令列的參數.
68
#回傳結果:
69
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
70
#$reuslt["error"],執行不正常結束的錯訊息陣列.
71
#$result["function"],當前執行的函式名稱.
72
#$result["argu"],使用的參數陣列.
73
#$result["content"],要回傳的參數陣列.
74
#$result["count"],參數的數量.
75
#$result["_GET"],收到的 HTTP GET 參數陣列.
76
#$result["_POST"],收到的 HTTP POST 參數陣列.
77
#必填參數:
78
#無
79
#可省略參數:
80
#$conf["echo"],"true"代表要將抓到的參數一個個印出來,"false"代表用回傳的方式,預設為"false".
81
$conf["echo"]="false";	
82
$getArgu=cmd::getArgu($conf);
83
 
84
#如果執行失敗
85
if($getArgu["status"]==="false"){
86
 
87
	#設置錯誤識別
88
	$result["status"]="false";
89
 
90
	#設置錯誤訊息
91
	$result["error"]=$getArgu;
92
 
93
	#debug
94
	var_dump($result);
95
 
96
	}#if end
97
 
98
#印出 json
99
echo json_encode($getArgu["content"]);
100
 
101
?>