Subversion Repositories qbpwcf-lib(archive)

Rev

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

Rev Author Line No. Line
529 liveuser 1
<?php
2
 
3
/*
4
 
5
        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
638 liveuser 6
    Copyright (C) 2015~2024 Min-Jhin,Chen
529 liveuser 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
#使用命名空間qbpwcf
26
namespace qbpwcf;
27
 
28
#匯入套件
29
require_once("qbpwcf/allInOneForJson.php");
30
 
31
#建議的log位置
32
$logFile=$_SERVER["DOCUMENT_ROOT"].$_SERVER["PHP_SELF"].".log";
33
 
709 liveuser 34
#要使用的範例name
35
#$nameOfSample="initial";
36
$nameOfSample="20240317";
529 liveuser 37
 
709 liveuser 38
#存放範例的資料夾
39
$sampleFolder="config::server";
529 liveuser 40
 
709 liveuser 41
#設置測試案例的檔案名稱與路徑
42
$fileNameOfSample=$sampleFolder."/".$nameOfSample.".php";
43
 
44
#初始化儲存範例代碼
45
$samples=array();
46
 
47
#增加config based on file的範例資訊
48
$samples[]=array("name"=>"initial","comnent"=>"config based on file");
49
 
50
#增加config based on variable的範例資訊
51
$samples[]=array("name"=>"20240317","comnent"=>"config based on variable");
52
 
53
#針對每個範例資訊
54
foreach($samples as $sample){
55
 
56
	#如果找到對應的範例
57
	if($sample["name"]===$nameOfSample){
529 liveuser 58
 
709 liveuser 59
		#如果存放範例的資料夾不存在
60
		if(!file_exists($sampleFolder)){
61
 
62
			#提示訊息
63
			echo "存放範例的資料夾(".$sampleFolder.")不存在".PHP_EOL;
64
 
65
			#結束執行,並回傳1給shell
66
			exit(1);
67
 
68
			}#if end
69
 
70
		#如果對應的範例檔案不存在
71
		if(!file_exists($fileNameOfSample)){
72
 
73
			#提示訊息
74
			echo "範例檔案(".$fileNameOfSample.")不存在".PHP_EOL;
75
 
76
			#結束執行,並回傳1給shell
77
			exit(1);
78
 
79
			}#if end
80
 
81
		#匯入範例
82
		require_once($fileNameOfSample);
83
 
84
		#結束執行
85
		exit;
86
 
87
		}#if end
529 liveuser 88
 
709 liveuser 89
	}#foreach end
90
 
91
#執行到這邊代表沒有對應的範例
529 liveuser 92
 
709 liveuser 93
#提示範例不存在
94
echo "範例(".$nameOfSample.")不存在".PHP_EOL;
529 liveuser 95
 
709 liveuser 96
#結束執行,並回傳1給shell
97
exit(1);
98
 
529 liveuser 99
?>