Subversion Repositories qbpwcf-lib(archive)

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
811 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
#匯入套件
30
require_once("qbpwcf/allInOne.php");
31
 
32
#建議的log位置
33
$logFile=$_SERVER["DOCUMENT_ROOT"].$_SERVER["PHP_SELF"].".log";
34
 
35
#要使用的範例name
36
$nameOfSample="20241125";
37
 
38
#存放範例的資料夾
39
$sampleFolder="cmd::registerService";
40
 
41
#設置測試案例的檔案名稱與路徑
42
$fileNameOfSample=$sampleFolder."/".$nameOfSample.".php";
43
 
44
#初始化儲存範例代碼
45
$samples=array();
46
 
47
#增加 cmd::chmod 的範例資訊
48
$samples[]=array("name"=>"20241125","comnent"=>"chown folder and it's content.");
49
 
50
#針對每個範例資訊
51
foreach($samples as $sample){
52
 
53
	#如果找到對應的範例
54
	if($sample["name"]===$nameOfSample){
55
 
56
		#如果存放範例的資料夾不存在
57
		if(!file_exists($sampleFolder)){
58
 
59
			#提示訊息
60
			echo "存放範例的資料夾(".$sampleFolder.")不存在".PHP_EOL;
61
 
62
			#結束執行,並回傳1給shell
63
			exit(1);
64
 
65
			}#if end
66
 
67
		#如果對應的範例檔案不存在
68
		if(!file_exists($fileNameOfSample)){
69
 
70
			#提示訊息
71
			echo "範例檔案(".$fileNameOfSample.")不存在".PHP_EOL;
72
 
73
			#結束執行,並回傳1給shell
74
			exit(1);
75
 
76
			}#if end
77
 
78
		#匯入範例
79
		require_once($fileNameOfSample);
80
 
81
		#結束執行
82
		exit;
83
 
84
		}#if end
85
 
86
	}#foreach end
87
 
88
#執行到這邊代表沒有對應的範例
89
 
90
#提示範例不存在
91
echo "範例(".$nameOfSample.")不存在".PHP_EOL;
92
 
93
#結束執行,並回傳1給shell
94
exit(1);
95
 
96
?>