| 814 |
liveuser |
1 |
#!/bin/php
|
|
|
2 |
<?php
|
|
|
3 |
|
|
|
4 |
/*
|
|
|
5 |
|
|
|
6 |
QBPWCF, Quick Build PHP website Component base on Fedora Linux.
|
|
|
7 |
Copyright (C) 2015~2024 Min-Jhin,Chen
|
|
|
8 |
|
|
|
9 |
This file is part of QBPWCF.
|
|
|
10 |
|
|
|
11 |
QBPWCF is free software: you can redistribute it and/or modify
|
|
|
12 |
it under the terms of the GNU General Public License as published by
|
|
|
13 |
the Free Software Foundation, either version 3 of the License, or
|
|
|
14 |
(at your option) any later version.
|
|
|
15 |
|
|
|
16 |
QBPWCF is distributed in the hope that it will be useful,
|
|
|
17 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
18 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
19 |
GNU General Public License for more details.
|
|
|
20 |
|
|
|
21 |
You should have received a copy of the GNU General Public License
|
|
|
22 |
along with QBPWCF. If not, see <http://www.gnu.org/licenses/>.
|
|
|
23 |
|
|
|
24 |
*/
|
|
|
25 |
|
|
|
26 |
#使用命名空間qbpwcf
|
|
|
27 |
namespace qbpwcf;
|
|
|
28 |
|
|
|
29 |
#以該檔案的實際位置的 lib path 為 include path 首位
|
|
|
30 |
exec("cd ".pathinfo(__FILE__)["dirname"]."/../qbpwcf;pwd;",$output,$status);
|
|
|
31 |
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
|
|
|
32 |
|
|
|
33 |
#匯入套件
|
|
|
34 |
require_once("allInOne.php");
|
|
|
35 |
|
|
|
36 |
#建議的log位置
|
|
|
37 |
$logFile=$_SERVER["DOCUMENT_ROOT"].$_SERVER["PHP_SELF"].".log";
|
|
|
38 |
|
|
|
39 |
#要使用的範例name
|
|
|
40 |
$nameOfSample="20241127";
|
|
|
41 |
|
|
|
42 |
#存放範例的資料夾
|
|
|
43 |
$sampleFolder="phpLib::getLibFileList";
|
|
|
44 |
|
|
|
45 |
#設置範例檔案名稱與路徑
|
|
|
46 |
$fileNameOfSample=$sampleFolder."/".$nameOfSample.".php";
|
|
|
47 |
|
|
|
48 |
#初始化儲存範例代碼
|
|
|
49 |
$samples=array();
|
|
|
50 |
|
|
|
51 |
#增加 phpLib::getLibFileList 的範例資訊
|
|
|
52 |
$samples[]=array("name"=>"20241127","comment"=>"test");
|
|
|
53 |
|
|
|
54 |
#針對每個範例資訊
|
|
|
55 |
foreach($samples as $sample){
|
|
|
56 |
|
|
|
57 |
#如果找到對應的範例
|
|
|
58 |
if($sample["name"]===$nameOfSample){
|
|
|
59 |
|
|
|
60 |
#如果存放範例的資料夾不存在
|
|
|
61 |
if(!file_exists($sampleFolder)){
|
|
|
62 |
|
|
|
63 |
#提示訊息
|
|
|
64 |
echo "存放範例的資料夾(".$sampleFolder.")不存在".PHP_EOL;
|
|
|
65 |
|
|
|
66 |
#結束執行,並回傳1給shell
|
|
|
67 |
exit(1);
|
|
|
68 |
|
|
|
69 |
}#if end
|
|
|
70 |
|
|
|
71 |
#如果對應的範例檔案不存在
|
|
|
72 |
if(!file_exists($fileNameOfSample)){
|
|
|
73 |
|
|
|
74 |
#提示訊息
|
|
|
75 |
echo "範例檔案(".$fileNameOfSample.")不存在".PHP_EOL;
|
|
|
76 |
|
|
|
77 |
#結束執行,並回傳1給shell
|
|
|
78 |
exit(1);
|
|
|
79 |
|
|
|
80 |
}#if end
|
|
|
81 |
|
|
|
82 |
#匯入範例
|
|
|
83 |
require_once($fileNameOfSample);
|
|
|
84 |
|
|
|
85 |
#結束執行
|
|
|
86 |
exit;
|
|
|
87 |
|
|
|
88 |
}#if end
|
|
|
89 |
|
|
|
90 |
}#foreach end
|
|
|
91 |
|
|
|
92 |
#執行到這邊代表沒有對應的範例
|
|
|
93 |
|
|
|
94 |
#提示範例不存在
|
|
|
95 |
echo "範例(".$nameOfSample.")不存在".PHP_EOL;
|
|
|
96 |
|
|
|
97 |
#結束執行,並回傳1給shell
|
|
|
98 |
exit(1);
|
|
|
99 |
|
|
|
100 |
?>
|