Subversion Repositories qbpwcf-lib(archive)

Rev

Rev 548 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
548 liveuser 1
<?php
2
 
637 liveuser 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
 
548 liveuser 25
#使用命名空間qbpwcf
26
namespace qbpwcf;
27
 
28
#匯入外部套件
29
require_once("qbpwcf/allInOne.php");
30
 
31
#函式說明:
32
#將字串特定關鍵字與其後面的內容剔除
33
#回傳結果:
34
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
35
#$result["error"],錯誤訊息陣列.
36
#$result["warning"],警告訊息鎮列.
37
#$result["founded"],有無找到定字串"true"代表有,"false"代表沒有.
38
#$result["function"],當前執行的函數名稱.
39
#$result["oriStr"],要處理的原始字串內容.
40
#$result["content"],處理好的的字串內容.
41
#$result["argu"],使用的參數.
42
#必填參數:
43
#$conf["stringIn"],字串,要處理的字串.
44
$conf["stringProcess::delStrAfterKeyWord"]["stringIn"]="How are you?";
45
#$conf["keyWord"],字串,特定字串.
46
$conf["stringProcess::delStrAfterKeyWord"]["keyWord"]=" ";
47
#可省略參數:
48
#$conf["deleteLastRepeatedOne"],字串,預設為"false";若為"true"則代表連續遇到同 $conf["keyWord"] 的內容,要將移除內容的起點往後移動到為後一個 $conf["keyWord"].
49
#$conf["deleteLastRepeatedOne"]="";
50
#參考資料:
51
#無.
52
#備註:
53
#無.
54
$delStrAfterKeyWord=stringProcess::delStrAfterKeyWord($conf["stringProcess::delStrAfterKeyWord"]);
55
unset($conf["stringProcess::delStrAfterKeyWord"]);
56
 
57
#如果執行失敗
58
if($delStrAfterKeyWord["status"]==="false"){
59
 
60
	#函式說明:
61
	#撰寫log
62
	#回傳結果:
63
	#$result["status"],狀態,"true"或"false".
64
	#$result["error"],錯誤訊息陣列.
65
	#$result["function"],當前函式的名稱.
66
	#$result["argu"],使用的參數.
67
	#必填參數:
68
	#$conf["path"],字串,log檔案的路徑與名稱.
69
	$conf["path"]=$logFile;
70
	#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
71
	$conf["content"]=$delStrAfterKeyWord;
72
	#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
73
	$conf["fileArgu"]=__FILE__;
74
	#可省略參數:
75
	#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
76
	#$conf["rewrite"]="false";
77
	#參考資料:
78
	#無.
79
	#備註:
80
	#無.
81
	$record=logs::record($conf);
82
	unset($conf);
83
 
84
	#如果寫log失敗
85
	if($record["status"]==="false"){
86
 
87
		#印出結果
88
		var_dump($record);
89
 
90
		}#if end
91
 
92
	#結束執行,回傳錯誤代碼1
93
	exit(1);
94
 
95
	}#if end
96
 
97
#印出結果
98
var_dump($delStrAfterKeyWord);
99
 
100
#函式說明:
101
#將字串特定關鍵字與其後面的內容剔除
102
#回傳結果:
103
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
104
#$result["error"],錯誤訊息陣列.
105
#$result["warning"],警告訊息鎮列.
106
#$result["founded"],有無找到定字串"true"代表有,"false"代表沒有.
107
#$result["function"],當前執行的函數名稱.
108
#$result["oriStr"],要處理的原始字串內容.
109
#$result["content"],處理好的的字串內容.
110
#$result["argu"],使用的參數.
111
#必填參數:
112
#$conf["stringIn"],字串,要處理的字串.
113
$conf["stringProcess::delStrAfterKeyWord"]["stringIn"]="How are you?";
114
#$conf["keyWord"],字串,特定字串.
115
$conf["stringProcess::delStrAfterKeyWord"]["keyWord"]=" ";
116
#可省略參數:
117
#$conf["deleteLastRepeatedOne"],字串,預設為"false";若為"true"則代表連續遇到同 $conf["keyWord"] 的內容,要將移除內容的起點往後移動到為後一個 $conf["keyWord"].
118
$conf["stringProcess::delStrAfterKeyWord"]["deleteLastRepeatedOne"]="true";
119
#參考資料:
120
#無.
121
#備註:
122
#無.
123
$delStrAfterKeyWord=stringProcess::delStrAfterKeyWord($conf["stringProcess::delStrAfterKeyWord"]);
124
unset($conf["stringProcess::delStrAfterKeyWord"]);
125
 
126
#如果執行失敗
127
if($delStrAfterKeyWord["status"]==="false"){
128
 
129
	#函式說明:
130
	#撰寫log
131
	#回傳結果:
132
	#$result["status"],狀態,"true"或"false".
133
	#$result["error"],錯誤訊息陣列.
134
	#$result["function"],當前函式的名稱.
135
	#$result["argu"],使用的參數.
136
	#必填參數:
137
	#$conf["path"],字串,log檔案的路徑與名稱.
138
	$conf["path"]=$logFile;
139
	#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
140
	$conf["content"]=$delStrAfterKeyWord;
141
	#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
142
	$conf["fileArgu"]=__FILE__;
143
	#可省略參數:
144
	#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
145
	#$conf["rewrite"]="false";
146
	#參考資料:
147
	#無.
148
	#備註:
149
	#無.
150
	$record=logs::record($conf);
151
	unset($conf);
152
 
153
	#如果寫log失敗
154
	if($record["status"]==="false"){
155
 
156
		#印出結果
157
		var_dump($record);
158
 
159
		}#if end
160
 
161
	#結束執行,回傳錯誤代碼1
162
	exit(1);
163
 
164
	}#if end
165
 
166
#印出結果
167
var_dump($delStrAfterKeyWord);
168
 
169
?>