Subversion Repositories php-qbpwcf

Rev

Rev 182 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 182 Rev 226
Line 1... Line 1...
1
<?php
1
<?php
2
 
2
 
3
/*
3
/*
4
 
4
 
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
6
    Copyright (C) 2014~2025 Min-Jhin,Chen
6
    Copyright (C) 2014~2025 MIN ZHI, CHEN
7
 
7
 
8
    This file is part of QBPWCF.
8
    This file is part of QBPWCF.
9
 
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
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
11
    it under the terms of the GNU General Public License as published by
Line 103... Line 103...
103
 
103
 
104
		#回傳結果
104
		#回傳結果
105
		return $result;
105
		return $result;
106
 
106
 
107
		}#function __callStatic end
107
		}#function __callStatic end
108
	
108
 
109
	/*
109
	/*
110
	#函式說明:
110
	#函式說明:
111
	#檢查陣列裡面的特定元素是否存在以及其變數型態是否正確,如果沒有設定則回傳提示訊息。
111
	#檢查陣列裡面的特定元素是否存在以及其變數型態是否正確,如果沒有設定則回傳提示訊息。
112
	#回傳結果:
112
	#回傳結果:
113
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
113
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 443... Line 443...
443
							#如果有設定$conf["variableType"]
443
							#如果有設定$conf["variableType"]
444
							if(isset($conf["variableType"])){
444
							if(isset($conf["variableType"])){
445
 
445
 
446
								#如果正確 type 為 "resource"
446
								#如果正確 type 為 "resource"
447
								if($conf["variableType"][$typeCount]==="resource"){
447
								if($conf["variableType"][$typeCount]==="resource"){
448
								
448
 
449
									#如果是 resource 開頭的形態
449
									#如果是 resource 開頭的形態
450
									if(strpos(gettype($varInputValue),$conf["variableType"][$typeCount])===0){
450
									if(strpos(gettype($varInputValue),$conf["variableType"][$typeCount])===0){
451
									
451
 
452
										#則給予型態認證通過的識別
452
										#則給予型態認證通過的識別
453
										$result["content"][$shouldBtCheckedVarName]["varType"]="true";
453
										$result["content"][$shouldBtCheckedVarName]["varType"]="true";
454
									
454
 
455
										}#if end
455
										}#if end
456
								
456
 
457
									}#if end
457
									}#if end
458
 
458
 
459
								#反之如果該變數的型態正確 或是要求的形態為null 或為 "any"
459
								#反之如果該變數的型態正確 或是要求的形態為null 或為 "any"
460
								else if($conf["variableType"][$typeCount]===gettype($varInputValue) || $conf["variableType"][$typeCount]===null || $conf["variableType"][$typeCount]==="any"){
460
								else if($conf["variableType"][$typeCount]===gettype($varInputValue) || $conf["variableType"][$typeCount]===null || $conf["variableType"][$typeCount]==="any"){
461
 
461
 
Line 533... Line 533...
533
						}#if end
533
						}#if end
534
 
534
 
535
					}#foreach end
535
					}#foreach end
536
 
536
 
537
				}#foreach end
537
				}#foreach end
538
			
538
 
539
			}#if end
539
			}#if end
540
 
540
 
541
		#如果 $result["passed"] 沒有設置
541
		#如果 $result["passed"] 沒有設置
542
		if(!isset($result["passed"])){
542
		if(!isset($result["passed"])){
543
 
543
 
Line 632... Line 632...
632
 
632
 
633
			}#if end
633
			}#if end
634
 
634
 
635
		#如果是 resource
635
		#如果是 resource
636
		if($conf["vType"]==="resource"){
636
		if($conf["vType"]==="resource"){
637
		
637
 
638
			#如果不是開頭為 "resource"  的形態
638
			#如果不是開頭為 "resource"  的形態
639
			if(strpos(gettype($conf["vName"]),$conf["vType"])!==0){
639
			if(strpos(gettype($conf["vName"]),$conf["vType"])!==0){
640
			
640
 
641
				#設置執行正常
641
				#設置執行正常
642
				$result["status"]="true";
642
				$result["status"]="true";
643
 
643
 
644
				#設置檢查不通過
644
				#設置檢查不通過
645
				$result["passed"]="false";
645
				$result["passed"]="false";
Line 647... Line 647...
647
				#設置錯誤訊息
647
				#設置錯誤訊息
648
				$result["error"][]="變數\$conf[\"vName\"]的形態應為".$conf["vType"];
648
				$result["error"][]="變數\$conf[\"vName\"]的形態應為".$conf["vType"];
649
 
649
 
650
				#回傳結果
650
				#回傳結果
651
				return $result;
651
				return $result;
652
			
652
 
653
				}#if end
653
				}#if end
654
		
654
 
655
			}#if end
655
			}#if end
656
 
656
 
657
		#反之若其變數形態不爲 $conf["vType"] 且期望的變數型態不為 "any"
657
		#反之若其變數形態不爲 $conf["vType"] 且期望的變數型態不為 "any"
658
		else if(gettype($conf["vName"])!=$conf["vType"] && $conf["vType"]!=="any"){
658
		else if(gettype($conf["vName"])!=$conf["vType"] && $conf["vType"]!=="any"){
659
 
659
 
Line 1454... Line 1454...
1454
					#如果 $conf["checkedVar"][$conf["sikpableVarNameArray"][$i]] 的型態不等於 $conf["sikpableVarTypeArray"][$i] 且 $conf["skipableVarTypeArray"][$i] 不為 null
1454
					#如果 $conf["checkedVar"][$conf["sikpableVarNameArray"][$i]] 的型態不等於 $conf["sikpableVarTypeArray"][$i] 且 $conf["skipableVarTypeArray"][$i] 不為 null
1455
					if(gettype($conf["checkedVar"][$conf["sikpableVarNameArray"][$i]])!=$conf["skipableVarTypeArray"][$i] && $conf["skipableVarTypeArray"][$i]!=null){
1455
					if(gettype($conf["checkedVar"][$conf["sikpableVarNameArray"][$i]])!=$conf["skipableVarTypeArray"][$i] && $conf["skipableVarTypeArray"][$i]!=null){
1456
 
1456
 
1457
						#type "any" 不用檢查
1457
						#type "any" 不用檢查
1458
						if($conf["skipableVarTypeArray"][$i]!=="any"){
1458
						if($conf["skipableVarTypeArray"][$i]!=="any"){
1459
						
1459
 
1460
							#設置執行正常
1460
							#設置執行正常
1461
							$result["status"]="true";
1461
							$result["status"]="true";
1462
 
1462
 
1463
							#設置執行錯誤識別
1463
							#設置執行錯誤識別
1464
							$result["passed"]="false";
1464
							$result["passed"]="false";
Line 1466... Line 1466...
1466
							#設置錯誤訊息
1466
							#設置錯誤訊息
1467
							$result["error"][]=$conf["sikpableVarNameArray"][$i]."須為".$conf["skipableVarTypeArray"][$i]."型態";
1467
							$result["error"][]=$conf["sikpableVarNameArray"][$i]."須為".$conf["skipableVarTypeArray"][$i]."型態";
1468
 
1468
 
1469
							#回傳結果
1469
							#回傳結果
1470
							return $result;
1470
							return $result;
1471
						
1471
 
1472
							}#if end
1472
							}#if end
1473
 
1473
 
1474
						}#if end
1474
						}#if end
1475
 
1475
 
1476
					}#if end
1476
					}#if end
Line 1566... Line 1566...
1566
	#array_keys=>http://php.net/manual/en/function.array-keys.php
1566
	#array_keys=>http://php.net/manual/en/function.array-keys.php
1567
	#備註:
1567
	#備註:
1568
	#無.
1568
	#無.
1569
	*/
1569
	*/
1570
	public static function checkArguments(&$conf){
1570
	public static function checkArguments(&$conf){
1571
		
1571
 
1572
		#初始化要回傳的結果
1572
		#初始化要回傳的結果
1573
		$result=array();
1573
		$result=array();
1574
 
1574
 
1575
		#設置當其函數名稱
1575
		#設置當其函數名稱
1576
		$result["function"]=__FUNCTION__;
1576
		$result["function"]=__FUNCTION__;
Line 1612... Line 1612...
1612
			$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
1612
			$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
1613
			unset($conf["variableCheck::getSimpleError"]);
1613
			unset($conf["variableCheck::getSimpleError"]);
1614
 
1614
 
1615
			#如果執行失敗
1615
			#如果執行失敗
1616
			if($getSimpleError["status"]==="false"){
1616
			if($getSimpleError["status"]==="false"){
1617
			
1617
 
1618
				#設置執行錯誤訊息
1618
				#設置執行錯誤訊息
1619
				$result["error"][]=$getSimpleError;
1619
				$result["error"][]=$getSimpleError;
1620
			
1620
 
1621
				#回傳結果
1621
				#回傳結果
1622
				return $result;
1622
				return $result;
1623
 
1623
 
1624
				}#if end
1624
				}#if end
1625
 
1625
 
Line 1687... Line 1687...
1687
			$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
1687
			$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
1688
			unset($conf["variableCheck::getSimpleError"]);
1688
			unset($conf["variableCheck::getSimpleError"]);
1689
 
1689
 
1690
			#如果執行失敗
1690
			#如果執行失敗
1691
			if($getSimpleError["status"]==="false"){
1691
			if($getSimpleError["status"]==="false"){
1692
			
1692
 
1693
				#設置執行錯誤訊息
1693
				#設置執行錯誤訊息
1694
				$result["error"][]=$getSimpleError;
1694
				$result["error"][]=$getSimpleError;
1695
			
1695
 
1696
				#回傳結果
1696
				#回傳結果
1697
				return $result;
1697
				return $result;
1698
 
1698
 
1699
				}#if end
1699
				}#if end
1700
 
1700
 
Line 1709... Line 1709...
1709
		#如果檢查不通過
1709
		#如果檢查不通過
1710
		if($checkResult["passed"]==="false"){
1710
		if($checkResult["passed"]==="false"){
1711
 
1711
 
1712
			#設置執正常
1712
			#設置執正常
1713
			$result["status"]="true";
1713
			$result["status"]="true";
1714
			
1714
 
1715
			#設置錯誤識別
1715
			#設置錯誤識別
1716
			$result["passed"]="false";
1716
			$result["passed"]="false";
1717
 
1717
 
1718
			#設置錯誤訊息
1718
			#設置錯誤訊息
1719
			$result["error"]=$checkResult;
1719
			$result["error"]=$checkResult;
Line 1738... Line 1738...
1738
			$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
1738
			$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
1739
			unset($conf["variableCheck::getSimpleError"]);
1739
			unset($conf["variableCheck::getSimpleError"]);
1740
 
1740
 
1741
			#如果執行失敗
1741
			#如果執行失敗
1742
			if($getSimpleError["status"]==="false"){
1742
			if($getSimpleError["status"]==="false"){
1743
			
1743
 
1744
				#設置執行錯誤訊息
1744
				#設置執行錯誤訊息
1745
				$result["error"][]=$getSimpleError;
1745
				$result["error"][]=$getSimpleError;
1746
			
1746
 
1747
				#回傳結果
1747
				#回傳結果
1748
				return $result;
1748
				return $result;
1749
 
1749
 
1750
				}#if end
1750
				}#if end
1751
 
1751
 
Line 1809... Line 1809...
1809
			$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
1809
			$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
1810
			unset($conf["variableCheck::getSimpleError"]);
1810
			unset($conf["variableCheck::getSimpleError"]);
1811
 
1811
 
1812
			#如果執行失敗
1812
			#如果執行失敗
1813
			if($getSimpleError["status"]==="false"){
1813
			if($getSimpleError["status"]==="false"){
1814
			
1814
 
1815
				#設置執行錯誤訊息
1815
				#設置執行錯誤訊息
1816
				$result["error"][]=$getSimpleError;
1816
				$result["error"][]=$getSimpleError;
1817
			
1817
 
1818
				#回傳結果
1818
				#回傳結果
1819
				return $result;
1819
				return $result;
1820
 
1820
 
1821
				}#if end
1821
				}#if end
1822
 
1822
 
Line 1831... Line 1831...
1831
		#如果檢查不通過
1831
		#如果檢查不通過
1832
		if($checkResult["passed"]=="false"){
1832
		if($checkResult["passed"]=="false"){
1833
 
1833
 
1834
			#設置執正常
1834
			#設置執正常
1835
			$result["status"]="true";
1835
			$result["status"]="true";
1836
			
1836
 
1837
			#設置錯誤識別
1837
			#設置錯誤識別
1838
			$result["passed"]="false";
1838
			$result["passed"]="false";
1839
 
1839
 
1840
			#設置錯誤訊息
1840
			#設置錯誤訊息
1841
			$result["error"]=$checkResult;
1841
			$result["error"]=$checkResult;
Line 1860... Line 1860...
1860
			$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
1860
			$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
1861
			unset($conf["variableCheck::getSimpleError"]);
1861
			unset($conf["variableCheck::getSimpleError"]);
1862
 
1862
 
1863
			#如果執行失敗
1863
			#如果執行失敗
1864
			if($getSimpleError["status"]==="false"){
1864
			if($getSimpleError["status"]==="false"){
1865
			
1865
 
1866
				#設置執行錯誤訊息
1866
				#設置執行錯誤訊息
1867
				$result["error"][]=$getSimpleError;
1867
				$result["error"][]=$getSimpleError;
1868
			
1868
 
1869
				#回傳結果
1869
				#回傳結果
1870
				return $result;
1870
				return $result;
1871
 
1871
 
1872
				}#if end
1872
				}#if end
1873
 
1873
 
Line 1911... Line 1911...
1911
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
1911
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
1912
				unset($conf["variableCheck::getSimpleError"]);
1912
				unset($conf["variableCheck::getSimpleError"]);
1913
 
1913
 
1914
				#如果執行失敗
1914
				#如果執行失敗
1915
				if($getSimpleError["status"]==="false"){
1915
				if($getSimpleError["status"]==="false"){
1916
				
1916
 
1917
					#設置執行錯誤訊息
1917
					#設置執行錯誤訊息
1918
					$result["error"][]=$getSimpleError;
1918
					$result["error"][]=$getSimpleError;
1919
				
1919
 
1920
					#回傳結果
1920
					#回傳結果
1921
					return $result;
1921
					return $result;
1922
 
1922
 
1923
					}#if end
1923
					}#if end
1924
 
1924
 
Line 2006... Line 2006...
2006
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2006
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2007
				unset($conf["variableCheck::getSimpleError"]);
2007
				unset($conf["variableCheck::getSimpleError"]);
2008
 
2008
 
2009
				#如果執行失敗
2009
				#如果執行失敗
2010
				if($getSimpleError["status"]==="false"){
2010
				if($getSimpleError["status"]==="false"){
2011
				
2011
 
2012
					#設置執行錯誤訊息
2012
					#設置執行錯誤訊息
2013
					$result["error"][]=$getSimpleError;
2013
					$result["error"][]=$getSimpleError;
2014
				
2014
 
2015
					#回傳結果
2015
					#回傳結果
2016
					return $result;
2016
					return $result;
2017
 
2017
 
2018
					}#if end
2018
					}#if end
2019
 
2019
 
2020
				#設置 $simpleError
2020
				#設置 $simpleError
2021
				$result["simpleError"]=$getSimpleError["content"];
2021
				$result["simpleError"]=$getSimpleError["content"];
2022
 
2022
 
2023
				#回傳結果
2023
				#回傳結果
2024
				return $result;
2024
				return $result;
2025
				
2025
 
2026
				}#if end
2026
				}#if end
2027
 
2027
 
2028
			#如果檢查不通過
2028
			#如果檢查不通過
2029
			if($checkResult["passed"]=="false"){
2029
			if($checkResult["passed"]=="false"){
2030
 
2030
 
2031
				#設置執正常
2031
				#設置執正常
2032
				$result["status"]="true";
2032
				$result["status"]="true";
2033
				
2033
 
2034
				#設置錯誤識別
2034
				#設置錯誤識別
2035
				$result["passed"]="false";
2035
				$result["passed"]="false";
2036
 
2036
 
2037
				#設置錯誤訊息
2037
				#設置錯誤訊息
2038
				$result["error"]=$checkResult;
2038
				$result["error"]=$checkResult;
Line 2057... Line 2057...
2057
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2057
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2058
				unset($conf["variableCheck::getSimpleError"]);
2058
				unset($conf["variableCheck::getSimpleError"]);
2059
 
2059
 
2060
				#如果執行失敗
2060
				#如果執行失敗
2061
				if($getSimpleError["status"]==="false"){
2061
				if($getSimpleError["status"]==="false"){
2062
				
2062
 
2063
					#設置執行錯誤訊息
2063
					#設置執行錯誤訊息
2064
					$result["error"][]=$getSimpleError;
2064
					$result["error"][]=$getSimpleError;
2065
				
2065
 
2066
					#回傳結果
2066
					#回傳結果
2067
					return $result;
2067
					return $result;
2068
 
2068
 
2069
					}#if end
2069
					}#if end
2070
 
2070
 
Line 2113... Line 2113...
2113
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2113
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2114
				unset($conf["variableCheck::getSimpleError"]);
2114
				unset($conf["variableCheck::getSimpleError"]);
2115
 
2115
 
2116
				#如果執行失敗
2116
				#如果執行失敗
2117
				if($getSimpleError["status"]==="false"){
2117
				if($getSimpleError["status"]==="false"){
2118
				
2118
 
2119
					#設置執行錯誤訊息
2119
					#設置執行錯誤訊息
2120
					$result["error"][]=$getSimpleError;
2120
					$result["error"][]=$getSimpleError;
2121
				
2121
 
2122
					#回傳結果
2122
					#回傳結果
2123
					return $result;
2123
					return $result;
2124
 
2124
 
2125
					}#if end
2125
					}#if end
2126
 
2126
 
Line 2140... Line 2140...
2140
			#如果 $conf["skipableVariableName"] 與 $conf["skipableVarDefaultValue"] 的元素數量不一致
2140
			#如果 $conf["skipableVariableName"] 與 $conf["skipableVarDefaultValue"] 的元素數量不一致
2141
			if(count($conf["skipableVariableName"])!=count($conf["skipableVarDefaultValue"])){
2141
			if(count($conf["skipableVariableName"])!=count($conf["skipableVarDefaultValue"])){
2142
 
2142
 
2143
				#設置執正常
2143
				#設置執正常
2144
				$result["status"]="true";
2144
				$result["status"]="true";
2145
				
2145
 
2146
				#設置錯誤識別
2146
				#設置錯誤識別
2147
				$result["passed"]="false";
2147
				$result["passed"]="false";
2148
 
2148
 
2149
				#設置錯誤訊息
2149
				#設置錯誤訊息
2150
				$result["error"][]="\$conf[\"skipableVariableName\"] 與 \$conf[\"skipableVarDefaultValue\"] 的元素數量不一致";
2150
				$result["error"][]="\$conf[\"skipableVariableName\"] 與 \$conf[\"skipableVarDefaultValue\"] 的元素數量不一致";
Line 2169... Line 2169...
2169
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2169
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2170
				unset($conf["variableCheck::getSimpleError"]);
2170
				unset($conf["variableCheck::getSimpleError"]);
2171
 
2171
 
2172
				#如果執行失敗
2172
				#如果執行失敗
2173
				if($getSimpleError["status"]==="false"){
2173
				if($getSimpleError["status"]==="false"){
2174
				
2174
 
2175
					#設置執行錯誤訊息
2175
					#設置執行錯誤訊息
2176
					$result["error"][]=$getSimpleError;
2176
					$result["error"][]=$getSimpleError;
2177
				
2177
 
2178
					#回傳結果
2178
					#回傳結果
2179
					return $result;
2179
					return $result;
2180
 
2180
 
2181
					}#if end
2181
					}#if end
2182
 
2182
 
Line 2358... Line 2358...
2358
										$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2358
										$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2359
										unset($conf["variableCheck::getSimpleError"]);
2359
										unset($conf["variableCheck::getSimpleError"]);
2360
 
2360
 
2361
										#如果執行失敗
2361
										#如果執行失敗
2362
										if($getSimpleError["status"]==="false"){
2362
										if($getSimpleError["status"]==="false"){
2363
										
2363
 
2364
											#設置執行錯誤訊息
2364
											#設置執行錯誤訊息
2365
											$result["error"][]=$getSimpleError;
2365
											$result["error"][]=$getSimpleError;
2366
										
2366
 
2367
											#回傳結果
2367
											#回傳結果
2368
											return $result;
2368
											return $result;
2369
 
2369
 
2370
											}#if end
2370
											}#if end
2371
 
2371
 
Line 2422... Line 2422...
2422
						}#if end
2422
						}#if end
2423
 
2423
 
2424
					}#if end
2424
					}#if end
2425
 
2425
 
2426
				}#else end
2426
				}#else end
2427
				
2427
 
2428
			#如果可省略變數有 any 型別
2428
			#如果可省略變數有 any 型別
2429
			if(in_array("any",$conf["skipableVariableType"])){
2429
			if(in_array("any",$conf["skipableVariableType"])){
2430
			
2430
 
2431
				#儲存可以為任意形態的變數
2431
				#儲存可以為任意形態的變數
2432
				$anyTypeVarName=array();
2432
				$anyTypeVarName=array();
2433
			
2433
 
2434
				#針對每個可省略參數的形態
2434
				#針對每個可省略參數的形態
2435
				foreach($conf["skipableVariableType"] as $varKey=>$varType){
2435
				foreach($conf["skipableVariableType"] as $varKey=>$varType){
2436
					
2436
 
2437
					#如果找到形態為any的變數形態
2437
					#如果找到形態為any的變數形態
2438
					if($varType==="any"){
2438
					if($varType==="any"){
2439
					
2439
 
2440
						#儲存形態為 any 的可省略變數名稱
2440
						#儲存形態為 any 的可省略變數名稱
2441
						$anyTypeVarName[]=$conf["skipableVariableName"][$varKey];
2441
						$anyTypeVarName[]=$conf["skipableVariableName"][$varKey];
2442
					
2442
 
2443
						}#if end
2443
						}#if end
2444
				
2444
 
2445
					}#foreach end			
2445
					}#foreach end
2446
				
2446
 
2447
				#針對每個 any type 的可省略變數名稱
2447
				#針對每個 any type 的可省略變數名稱
2448
				foreach($anyTypeVarName as $varName){
2448
				foreach($anyTypeVarName as $varName){
2449
				
2449
 
2450
					#如果該可省略變數存在
2450
					#如果該可省略變數存在
2451
					if(isset($conf["varInput"][$varName])){
2451
					if(isset($conf["varInput"][$varName])){
2452
					
2452
 
2453
						#取得變數的形態
2453
						#取得變數的形態
2454
						$varType=gettype($conf["varInput"][$varName]);
2454
						$varType=gettype($conf["varInput"][$varName]);
2455
					
2455
 
2456
						#判斷變數的形態
2456
						#判斷變數的形態
2457
						switch($varType){
2457
						switch($varType){
2458
						
2458
 
2459
							#如果是字串
2459
							#如果是字串
2460
							case "string":
2460
							case "string":
2461
							
2461
 
2462
								#如果 $conf["disallowAllSkipableVarIsEmpty"] 設置為 "true"
2462
								#如果 $conf["disallowAllSkipableVarIsEmpty"] 設置為 "true"
2463
								if($conf["disallowAllSkipableVarIsEmpty"]==="true"){
2463
								if($conf["disallowAllSkipableVarIsEmpty"]==="true"){
2464
 
2464
 
2465
									#如果該變數是不被允許的空字串
2465
									#如果該變數是不被允許的空字串
2466
									if($conf["varInput"][$varName]===""){
2466
									if($conf["varInput"][$varName]===""){
2467
									
2467
 
2468
										#設置執行正常
2468
										#設置執行正常
2469
										$result["status"]="true";
2469
										$result["status"]="true";
2470
 
2470
 
2471
										#設置檢查不通過
2471
										#設置檢查不通過
2472
										$result["passed"]="false";
2472
										$result["passed"]="false";
Line 2474... Line 2474...
2474
										#設置錯誤訊息
2474
										#設置錯誤訊息
2475
										$result["warning"][]="可省略參數".$varName."不都得為空陣列";
2475
										$result["warning"][]="可省略參數".$varName."不都得為空陣列";
2476
 
2476
 
2477
										#回傳結果
2477
										#回傳結果
2478
										return $result;
2478
										return $result;
2479
									
2479
 
2480
										}#if end
2480
										}#if end
2481
 
2481
 
2482
									}#if end
2482
									}#if end
2483
							
2483
 
2484
								#跳出switch
2484
								#跳出switch
2485
								break;
2485
								break;
2486
								
2486
 
2487
							#如果是陣列
2487
							#如果是陣列
2488
							case "array":
2488
							case "array":
2489
							
2489
 
2490
								#如果 $conf["disallowAllSkipableVarIsEmptyArray"] 為 "true"
2490
								#如果 $conf["disallowAllSkipableVarIsEmptyArray"] 為 "true"
2491
								if($conf["disallowAllSkipableVarIsEmptyArray"]==="true"){
2491
								if($conf["disallowAllSkipableVarIsEmptyArray"]==="true"){
2492
								
2492
 
2493
									#如果該變數是不被允許的空陣列
2493
									#如果該變數是不被允許的空陣列
2494
									if($conf["varInput"][$varName]===array()){
2494
									if($conf["varInput"][$varName]===array()){
2495
									
2495
 
2496
										#設置執行正常
2496
										#設置執行正常
2497
										$result["status"]="true";
2497
										$result["status"]="true";
2498
 
2498
 
2499
										#設置檢查不通過
2499
										#設置檢查不通過
2500
										$result["passed"]="false";
2500
										$result["passed"]="false";
Line 2502... Line 2502...
2502
										#設置錯誤訊息
2502
										#設置錯誤訊息
2503
										$result["warning"][]="可省略參數".$varName."不都得為空陣列";
2503
										$result["warning"][]="可省略參數".$varName."不都得為空陣列";
2504
 
2504
 
2505
										#回傳結果
2505
										#回傳結果
2506
										return $result;
2506
										return $result;
2507
									
2507
 
2508
										}#if end
2508
										}#if end
2509
								
2509
 
2510
									}#if end
2510
									}#if end
2511
							
2511
 
2512
								#跳出switch
2512
								#跳出switch
2513
								break;
2513
								break;
2514
								
2514
 
2515
							default:
2515
							default:
2516
						
2516
 
2517
							}#switch end
2517
							}#switch end
2518
					
2518
 
2519
						}#if end
2519
						}#if end
2520
				
2520
 
2521
					}#foreach end
2521
					}#foreach end
2522
								
2522
 
2523
				}#if end
2523
				}#if end
2524
 
2524
 
2525
			}#if end
2525
			}#if end
2526
 
2526
 
2527
		#如果 $conf["skipableVarDefaultValue"] 有設置
2527
		#如果 $conf["skipableVarDefaultValue"] 有設置
Line 2582... Line 2582...
2582
							$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2582
							$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2583
							unset($conf["variableCheck::getSimpleError"]);
2583
							unset($conf["variableCheck::getSimpleError"]);
2584
 
2584
 
2585
							#如果執行失敗
2585
							#如果執行失敗
2586
							if($getSimpleError["status"]==="false"){
2586
							if($getSimpleError["status"]==="false"){
2587
							
2587
 
2588
								#設置執行錯誤訊息
2588
								#設置執行錯誤訊息
2589
								$result["error"][]=$getSimpleError;
2589
								$result["error"][]=$getSimpleError;
2590
							
2590
 
2591
								#回傳結果
2591
								#回傳結果
2592
								return $result;
2592
								return $result;
2593
 
2593
 
2594
								}#if end
2594
								}#if end
2595
 
2595
 
Line 2650... Line 2650...
2650
								$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2650
								$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2651
								unset($conf["variableCheck::getSimpleError"]);
2651
								unset($conf["variableCheck::getSimpleError"]);
2652
 
2652
 
2653
								#如果執行失敗
2653
								#如果執行失敗
2654
								if($getSimpleError["status"]==="false"){
2654
								if($getSimpleError["status"]==="false"){
2655
								
2655
 
2656
									#設置執行錯誤訊息
2656
									#設置執行錯誤訊息
2657
									$result["error"][]=$getSimpleError;
2657
									$result["error"][]=$getSimpleError;
2658
								
2658
 
2659
									#回傳結果
2659
									#回傳結果
2660
									return $result;
2660
									return $result;
2661
 
2661
 
2662
									}#if end
2662
									}#if end
2663
 
2663
 
Line 2698... Line 2698...
2698
								$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2698
								$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2699
								unset($conf["variableCheck::getSimpleError"]);
2699
								unset($conf["variableCheck::getSimpleError"]);
2700
 
2700
 
2701
								#如果執行失敗
2701
								#如果執行失敗
2702
								if($getSimpleError["status"]==="false"){
2702
								if($getSimpleError["status"]==="false"){
2703
								
2703
 
2704
									#設置執行錯誤訊息
2704
									#設置執行錯誤訊息
2705
									$result["error"][]=$getSimpleError;
2705
									$result["error"][]=$getSimpleError;
2706
								
2706
 
2707
									#回傳結果
2707
									#回傳結果
2708
									return $result;
2708
									return $result;
2709
 
2709
 
2710
									}#if end
2710
									}#if end
2711
 
2711
 
Line 2783... Line 2783...
2783
								$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2783
								$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2784
								unset($conf["variableCheck::getSimpleError"]);
2784
								unset($conf["variableCheck::getSimpleError"]);
2785
 
2785
 
2786
								#如果執行失敗
2786
								#如果執行失敗
2787
								if($getSimpleError["status"]==="false"){
2787
								if($getSimpleError["status"]==="false"){
2788
								
2788
 
2789
									#設置執行錯誤訊息
2789
									#設置執行錯誤訊息
2790
									$result["error"][]=$getSimpleError;
2790
									$result["error"][]=$getSimpleError;
2791
								
2791
 
2792
									#回傳結果
2792
									#回傳結果
2793
									return $result;
2793
									return $result;
2794
 
2794
 
2795
									}#if end
2795
									}#if end
2796
 
2796
 
2797
								#設置 $simpleError
2797
								#設置 $simpleError
2798
								$result["simpleError"]=$getSimpleError["content"];
2798
								$result["simpleError"]=$getSimpleError["content"];
2799
 
2799
 
2800
								#回傳結果
2800
								#回傳結果
2801
								return $result;
2801
								return $result;
2802
							
2802
 
2803
								}#if end
2803
								}#if end
2804
 
2804
 
2805
							#如果檢查不通過
2805
							#如果檢查不通過
2806
							if($checkResult["passed"]=="false"){
2806
							if($checkResult["passed"]=="false"){
2807
 
2807
 
Line 2834... Line 2834...
2834
								$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2834
								$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2835
								unset($conf["variableCheck::getSimpleError"]);
2835
								unset($conf["variableCheck::getSimpleError"]);
2836
 
2836
 
2837
								#如果執行失敗
2837
								#如果執行失敗
2838
								if($getSimpleError["status"]==="false"){
2838
								if($getSimpleError["status"]==="false"){
2839
								
2839
 
2840
									#設置執行錯誤訊息
2840
									#設置執行錯誤訊息
2841
									$result["error"][]=$getSimpleError;
2841
									$result["error"][]=$getSimpleError;
2842
								
2842
 
2843
									#回傳結果
2843
									#回傳結果
2844
									return $result;
2844
									return $result;
2845
 
2845
 
2846
									}#if end
2846
									}#if end
2847
 
2847
 
Line 2908... Line 2908...
2908
								$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2908
								$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2909
								unset($conf["variableCheck::getSimpleError"]);
2909
								unset($conf["variableCheck::getSimpleError"]);
2910
 
2910
 
2911
								#如果執行失敗
2911
								#如果執行失敗
2912
								if($getSimpleError["status"]==="false"){
2912
								if($getSimpleError["status"]==="false"){
2913
								
2913
 
2914
									#設置執行錯誤訊息
2914
									#設置執行錯誤訊息
2915
									$result["error"][]=$getSimpleError;
2915
									$result["error"][]=$getSimpleError;
2916
								
2916
 
2917
									#回傳結果
2917
									#回傳結果
2918
									return $result;
2918
									return $result;
2919
 
2919
 
2920
									}#if end
2920
									}#if end
2921
 
2921
 
Line 2927... Line 2927...
2927
 
2927
 
2928
								}#if end
2928
								}#if end
2929
 
2929
 
2930
							#如果檢查不通過
2930
							#如果檢查不通過
2931
							if($checkResult["passed"]=="false"){
2931
							if($checkResult["passed"]=="false"){
2932
								
2932
 
2933
								#設置執正常
2933
								#設置執正常
2934
								$result["status"]="true";
2934
								$result["status"]="true";
2935
											
2935
 
2936
								#設置錯誤識別
2936
								#設置錯誤識別
2937
								$result["passed"]="false";
2937
								$result["passed"]="false";
2938
 
2938
 
2939
								#設置錯誤訊息
2939
								#設置錯誤訊息
2940
								$result["error"]=$checkResult;
2940
								$result["error"]=$checkResult;
Line 2959... Line 2959...
2959
								$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2959
								$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
2960
								unset($conf["variableCheck::getSimpleError"]);
2960
								unset($conf["variableCheck::getSimpleError"]);
2961
 
2961
 
2962
								#如果執行失敗
2962
								#如果執行失敗
2963
								if($getSimpleError["status"]==="false"){
2963
								if($getSimpleError["status"]==="false"){
2964
								
2964
 
2965
									#設置執行錯誤訊息
2965
									#設置執行錯誤訊息
2966
									$result["error"][]=$getSimpleError;
2966
									$result["error"][]=$getSimpleError;
2967
								
2967
 
2968
									#回傳結果
2968
									#回傳結果
2969
									return $result;
2969
									return $result;
2970
 
2970
 
2971
									}#if end
2971
									}#if end
2972
 
2972
 
Line 3044... Line 3044...
3044
							$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3044
							$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3045
							unset($conf["variableCheck::getSimpleError"]);
3045
							unset($conf["variableCheck::getSimpleError"]);
3046
 
3046
 
3047
							#如果執行失敗
3047
							#如果執行失敗
3048
							if($getSimpleError["status"]==="false"){
3048
							if($getSimpleError["status"]==="false"){
3049
							
3049
 
3050
								#設置執行錯誤訊息
3050
								#設置執行錯誤訊息
3051
								$result["error"][]=$getSimpleError;
3051
								$result["error"][]=$getSimpleError;
3052
							
3052
 
3053
								#回傳結果
3053
								#回傳結果
3054
								return $result;
3054
								return $result;
3055
 
3055
 
3056
								}#if end
3056
								}#if end
3057
 
3057
 
Line 3066... Line 3066...
3066
						#如果檢查不通過
3066
						#如果檢查不通過
3067
						if($checkResult["passed"]=="false"){
3067
						if($checkResult["passed"]=="false"){
3068
 
3068
 
3069
							#設置執正常
3069
							#設置執正常
3070
							$result["status"]="true";
3070
							$result["status"]="true";
3071
							
3071
 
3072
							#設置錯誤識別
3072
							#設置錯誤識別
3073
							$result["passed"]="false";
3073
							$result["passed"]="false";
3074
 
3074
 
3075
							#設置錯誤訊息
3075
							#設置錯誤訊息
3076
							$result["error"]=$checkResult;
3076
							$result["error"]=$checkResult;
Line 3095... Line 3095...
3095
							$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3095
							$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3096
							unset($conf["variableCheck::getSimpleError"]);
3096
							unset($conf["variableCheck::getSimpleError"]);
3097
 
3097
 
3098
							#如果執行失敗
3098
							#如果執行失敗
3099
							if($getSimpleError["status"]==="false"){
3099
							if($getSimpleError["status"]==="false"){
3100
							
3100
 
3101
								#設置執行錯誤訊息
3101
								#設置執行錯誤訊息
3102
								$result["error"][]=$getSimpleError;
3102
								$result["error"][]=$getSimpleError;
3103
							
3103
 
3104
								#回傳結果
3104
								#回傳結果
3105
								return $result;
3105
								return $result;
3106
 
3106
 
3107
								}#if end
3107
								}#if end
3108
 
3108
 
Line 3171... Line 3171...
3171
						$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3171
						$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3172
						unset($conf["variableCheck::getSimpleError"]);
3172
						unset($conf["variableCheck::getSimpleError"]);
3173
 
3173
 
3174
						#如果執行失敗
3174
						#如果執行失敗
3175
						if($getSimpleError["status"]==="false"){
3175
						if($getSimpleError["status"]==="false"){
3176
						
3176
 
3177
							#設置執行錯誤訊息
3177
							#設置執行錯誤訊息
3178
							$result["error"][]=$getSimpleError;
3178
							$result["error"][]=$getSimpleError;
3179
						
3179
 
3180
							#回傳結果
3180
							#回傳結果
3181
							return $result;
3181
							return $result;
3182
 
3182
 
3183
							}#if end
3183
							}#if end
3184
 
3184
 
Line 3193... Line 3193...
3193
					#如果檢查不通過
3193
					#如果檢查不通過
3194
					if($checkResult["passed"]=="false"){
3194
					if($checkResult["passed"]=="false"){
3195
 
3195
 
3196
						#設置執正常
3196
						#設置執正常
3197
						$result["status"]="true";
3197
						$result["status"]="true";
3198
						
3198
 
3199
						#設置錯誤識別
3199
						#設置錯誤識別
3200
						$result["passed"]="false";
3200
						$result["passed"]="false";
3201
 
3201
 
3202
						#設置錯誤訊息
3202
						#設置錯誤訊息
3203
						$result["error"]=$checkResult;
3203
						$result["error"]=$checkResult;
Line 3222... Line 3222...
3222
						$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3222
						$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3223
						unset($conf["variableCheck::getSimpleError"]);
3223
						unset($conf["variableCheck::getSimpleError"]);
3224
 
3224
 
3225
						#如果執行失敗
3225
						#如果執行失敗
3226
						if($getSimpleError["status"]==="false"){
3226
						if($getSimpleError["status"]==="false"){
3227
						
3227
 
3228
							#設置執行錯誤訊息
3228
							#設置執行錯誤訊息
3229
							$result["error"][]=$getSimpleError;
3229
							$result["error"][]=$getSimpleError;
3230
						
3230
 
3231
							#回傳結果
3231
							#回傳結果
3232
							return $result;
3232
							return $result;
3233
 
3233
 
3234
							}#if end
3234
							}#if end
3235
 
3235
 
Line 3284... Line 3284...
3284
					#如果跟第一個變數的元素數量不一樣
3284
					#如果跟第一個變數的元素數量不一樣
3285
					if($tempEqualCount[0]!=$tempEqualCount[$j]){
3285
					if($tempEqualCount[0]!=$tempEqualCount[$j]){
3286
 
3286
 
3287
						#設置執正常
3287
						#設置執正常
3288
						$result["status"]="true";
3288
						$result["status"]="true";
3289
						
3289
 
3290
						#設置錯誤識別
3290
						#設置錯誤識別
3291
						$result["passed"]="false";
3291
						$result["passed"]="false";
3292
 
3292
 
3293
						#設置錯誤訊息
3293
						#設置錯誤訊息
3294
						$result["error"][]="key為".$conf["arrayCountEqualCheck"][$i][0]."與".$conf["arrayCountEqualCheck"][$i][$j]."的參數其元數數量不一致";
3294
						$result["error"][]="key為".$conf["arrayCountEqualCheck"][$i][0]."與".$conf["arrayCountEqualCheck"][$i][$j]."的參數其元數數量不一致";
Line 3319... Line 3319...
3319
						$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3319
						$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3320
						unset($conf["variableCheck::getSimpleError"]);
3320
						unset($conf["variableCheck::getSimpleError"]);
3321
 
3321
 
3322
						#如果執行失敗
3322
						#如果執行失敗
3323
						if($getSimpleError["status"]==="false"){
3323
						if($getSimpleError["status"]==="false"){
3324
						
3324
 
3325
							#設置執行錯誤訊息
3325
							#設置執行錯誤訊息
3326
							$result["error"][]=$getSimpleError;
3326
							$result["error"][]=$getSimpleError;
3327
						
3327
 
3328
							#回傳結果
3328
							#回傳結果
3329
							return $result;
3329
							return $result;
3330
 
3330
 
3331
							}#if end
3331
							}#if end
3332
 
3332
 
Line 3365... Line 3365...
3365
				$arguArray[]=$conf["skipableVariableName"][$i];
3365
				$arguArray[]=$conf["skipableVariableName"][$i];
3366
 
3366
 
3367
				}#for end
3367
				}#for end
3368
 
3368
 
3369
			}#if end
3369
			}#if end
3370
			
3370
 
3371
		#如果有可省略變數的any形態變數設定		
3371
		#如果有可省略變數的any形態變數設定
3372
		if(isset($anyTypeVarName)){
3372
		if(isset($anyTypeVarName)){
3373
		
3373
 
3374
			#針對每個可省略的any形態變數
3374
			#針對每個可省略的any形態變數
3375
			foreach($anyTypeVarName as $varName){
3375
			foreach($anyTypeVarName as $varName){
3376
			
3376
 
3377
				#記錄參數
3377
				#記錄參數
3378
				$arguArray[]=$varName;
3378
				$arguArray[]=$varName;
3379
			
3379
 
3380
				}#foreach end
3380
				}#foreach end
3381
		
3381
 
3382
			}#if end
3382
			}#if end
3383
 
3383
 
3384
		#初始化儲存已經輸入的參數名稱陣列
3384
		#初始化儲存已經輸入的參數名稱陣列
3385
		$inputVarArray=array();
3385
		$inputVarArray=array();
3386
 
3386
 
Line 3462... Line 3462...
3462
			$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3462
			$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3463
			unset($conf["variableCheck::getSimpleError"]);
3463
			unset($conf["variableCheck::getSimpleError"]);
3464
 
3464
 
3465
			#如果執行失敗
3465
			#如果執行失敗
3466
			if($getSimpleError["status"]==="false"){
3466
			if($getSimpleError["status"]==="false"){
3467
			
3467
 
3468
				#設置執行錯誤訊息
3468
				#設置執行錯誤訊息
3469
				$result["error"][]=$getSimpleError;
3469
				$result["error"][]=$getSimpleError;
3470
			
3470
 
3471
				#回傳結果
3471
				#回傳結果
3472
				return $result;
3472
				return $result;
3473
 
3473
 
3474
				}#if end
3474
				}#if end
3475
 
3475
 
Line 3547... Line 3547...
3547
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3547
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3548
				unset($conf["variableCheck::getSimpleError"]);
3548
				unset($conf["variableCheck::getSimpleError"]);
3549
 
3549
 
3550
				#如果執行失敗
3550
				#如果執行失敗
3551
				if($getSimpleError["status"]==="false"){
3551
				if($getSimpleError["status"]==="false"){
3552
				
3552
 
3553
					#設置執行錯誤訊息
3553
					#設置執行錯誤訊息
3554
					$result["error"][]=$getSimpleError;
3554
					$result["error"][]=$getSimpleError;
3555
				
3555
 
3556
					#回傳結果
3556
					#回傳結果
3557
					return $result;
3557
					return $result;
3558
 
3558
 
3559
					}#if end
3559
					}#if end
3560
 
3560
 
Line 3568... Line 3568...
3568
 
3568
 
3569
			}#if end
3569
			}#if end
3570
 
3570
 
3571
		#如果有設定可省略參數且不允許所有可省略變數都不存在
3571
		#如果有設定可省略參數且不允許所有可省略變數都不存在
3572
		if( isset($conf["skipableVariableName"]) && ($conf["disallowAllSkipableVarNotExist"]==="true") ){
3572
		if( isset($conf["skipableVariableName"]) && ($conf["disallowAllSkipableVarNotExist"]==="true") ){
3573
			
3573
 
3574
			#函式說明:
3574
			#函式說明:
3575
			#檢查多個字串中的每個字串是否有多個關鍵字
3575
			#檢查多個字串中的每個字串是否有多個關鍵字
3576
			#回傳結果:
3576
			#回傳結果:
3577
			#$result["status"],整體來說,執行是否成功,"true"代表執行成功,"false"代表執行失敗。
3577
			#$result["status"],整體來說,執行是否成功,"true"代表執行成功,"false"代表執行失敗。
3578
			#$result["function"],當前執行的函數名稱.
3578
			#$result["function"],當前執行的函數名稱.
Line 3595... Line 3595...
3595
			#無.
3595
			#無.
3596
			#備註:
3596
			#備註:
3597
			#無.
3597
			#無.
3598
			$findManyKeyWordsFromManyString=search::findManyKeyWordsFromManyString($conf["search::findManyKeyWordsFromManyString"]);
3598
			$findManyKeyWordsFromManyString=search::findManyKeyWordsFromManyString($conf["search::findManyKeyWordsFromManyString"]);
3599
			unset($conf["search::findManyKeyWordsFromManyString"]);
3599
			unset($conf["search::findManyKeyWordsFromManyString"]);
3600
			
3600
 
3601
			#如果執行失敗
3601
			#如果執行失敗
3602
			if($findManyKeyWordsFromManyString["status"]==="false"){
3602
			if($findManyKeyWordsFromManyString["status"]==="false"){
3603
			
3603
 
3604
				#設置錯誤識別
3604
				#設置錯誤識別
3605
				$result["status"]="false";
3605
				$result["status"]="false";
3606
 
3606
 
3607
				#設置檢查不通過
3607
				#設置檢查不通過
3608
				$result["passed"]="false";
3608
				$result["passed"]="false";
3609
				
3609
 
3610
				#設置執行錯誤訊息
3610
				#設置執行錯誤訊息
3611
				$result["error"]=$findManyKeyWordsFromManyString;
3611
				$result["error"]=$findManyKeyWordsFromManyString;
3612
 
3612
 
3613
				#函式說明:
3613
				#函式說明:
3614
				#取得簡單的錯誤訊息
3614
				#取得簡單的錯誤訊息
Line 3630... Line 3630...
3630
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3630
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3631
				unset($conf["variableCheck::getSimpleError"]);
3631
				unset($conf["variableCheck::getSimpleError"]);
3632
 
3632
 
3633
				#如果執行失敗
3633
				#如果執行失敗
3634
				if($getSimpleError["status"]==="false"){
3634
				if($getSimpleError["status"]==="false"){
3635
				
3635
 
3636
					#設置執行錯誤訊息
3636
					#設置執行錯誤訊息
3637
					$result["error"][]=$getSimpleError;
3637
					$result["error"][]=$getSimpleError;
3638
				
3638
 
3639
					#回傳結果
3639
					#回傳結果
3640
					return $result;
3640
					return $result;
3641
 
3641
 
3642
					}#if end
3642
					}#if end
3643
 
3643
 
3644
				#設置 $simpleError
3644
				#設置 $simpleError
3645
				$result["simpleError"]=$getSimpleError["content"];
3645
				$result["simpleError"]=$getSimpleError["content"];
3646
 
3646
 
3647
				#回傳結果
3647
				#回傳結果
3648
				return $result;
3648
				return $result;
3649
			
3649
 
3650
				}#if end
3650
				}#if end
3651
				
3651
 
3652
			#如果沒有找到至少一個可省略參數存在
3652
			#如果沒有找到至少一個可省略參數存在
3653
			if(count($findManyKeyWordsFromManyString["foundedTrueKey"])===0){
3653
			if(count($findManyKeyWordsFromManyString["foundedTrueKey"])===0){
3654
			
3654
 
3655
				#設置執行正常
3655
				#設置執行正常
3656
				$result["status"]="true";
3656
				$result["status"]="true";
3657
 
3657
 
3658
				#設置檢查不通過
3658
				#設置檢查不通過
3659
				$result["passed"]="false";
3659
				$result["passed"]="false";
3660
				
3660
 
3661
				#設置執行錯誤訊息
3661
				#設置執行錯誤訊息
3662
				$result["error"]=$findManyKeyWordsFromManyString;
3662
				$result["error"]=$findManyKeyWordsFromManyString;
3663
 
3663
 
3664
				#函式說明:
3664
				#函式說明:
3665
				#取得簡單的錯誤訊息
3665
				#取得簡單的錯誤訊息
Line 3681... Line 3681...
3681
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3681
				$getSimpleError=variableCheck::getSimpleError($conf["variableCheck::getSimpleError"]);
3682
				unset($conf["variableCheck::getSimpleError"]);
3682
				unset($conf["variableCheck::getSimpleError"]);
3683
 
3683
 
3684
				#如果執行失敗
3684
				#如果執行失敗
3685
				if($getSimpleError["status"]==="false"){
3685
				if($getSimpleError["status"]==="false"){
3686
				
3686
 
3687
					#設置執行錯誤訊息
3687
					#設置執行錯誤訊息
3688
					$result["error"][]=$getSimpleError;
3688
					$result["error"][]=$getSimpleError;
3689
				
3689
 
3690
					#回傳結果
3690
					#回傳結果
3691
					return $result;
3691
					return $result;
3692
 
3692
 
3693
					}#if end
3693
					}#if end
3694
 
3694
 
3695
				#設置 $simpleError
3695
				#設置 $simpleError
3696
				$result["simpleError"]=$getSimpleError["content"];
3696
				$result["simpleError"]=$getSimpleError["content"];
3697
 
3697
 
3698
				#回傳結果
3698
				#回傳結果
3699
				return $result;
3699
				return $result;
3700
			
3700
 
3701
				}#if end
3701
				}#if end
3702
		
3702
 
3703
			}#if end
3703
			}#if end
3704
 
3704
 
3705
		#設置執行正常
3705
		#設置執行正常
3706
		$result["status"]="true";
3706
		$result["status"]="true";
3707
 
3707
 
Line 3937... Line 3937...
3937
	#無.
3937
	#無.
3938
	#備註:
3938
	#備註:
3939
	#無.
3939
	#無.
3940
	*/
3940
	*/
3941
	public static function toSource(&$conf){
3941
	public static function toSource(&$conf){
3942
	
3942
 
3943
		#初始化要回傳的內容
3943
		#初始化要回傳的內容
3944
		$result=array();
3944
		$result=array();
3945
 
3945
 
3946
		#取得當前執行的函數名稱
3946
		#取得當前執行的函數名稱
3947
		$result["function"]=__FUNCTION__;
3947
		$result["function"]=__FUNCTION__;
3948
 
3948
 
3949
		#如果 $conf 不為陣列
3949
		#如果 $conf 不為陣列
3950
		if(gettype($conf)!="array"){
3950
		if(gettype($conf)!="array"){
3951
			
3951
 
3952
			#設置執行失敗
3952
			#設置執行失敗
3953
			$result["status"]="false";
3953
			$result["status"]="false";
3954
			
3954
 
3955
			#設置執行錯誤訊息
3955
			#設置執行錯誤訊息
3956
			$result["error"][]="\$conf變數須為陣列形態";
3956
			$result["error"][]="\$conf變數須為陣列形態";
3957
 
3957
 
3958
			#如果傳入的參數為 null
3958
			#如果傳入的參數為 null
3959
			if($conf==null){
3959
			if($conf==null){
3960
				
3960
 
3961
				#設置執行錯誤訊息
3961
				#設置執行錯誤訊息
3962
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
3962
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
3963
				
3963
 
3964
				}#if end
3964
				}#if end
3965
 
3965
 
3966
			#回傳結果
3966
			#回傳結果
3967
			return $result;
3967
			return $result;
3968
			
3968
 
3969
			}#if end
3969
			}#if end
3970
		
3970
 
3971
		#檢查參數
3971
		#檢查參數
3972
		#函式說明:
3972
		#函式說明:
3973
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
3973
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
3974
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
3974
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
3975
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
3975
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 3981... Line 3981...
3981
		#必填寫的參數:
3981
		#必填寫的參數:
3982
		#$conf["variableCheck.checkArguments"]["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
3982
		#$conf["variableCheck.checkArguments"]["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
3983
		$conf["variableCheck.checkArguments"]["varInput"]=&$conf;
3983
		$conf["variableCheck.checkArguments"]["varInput"]=&$conf;
3984
		#$conf["variableCheck.checkArguments"]["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
3984
		#$conf["variableCheck.checkArguments"]["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
3985
		$conf["variableCheck.checkArguments"]["mustBeFilledVariableName"]=array("var");
3985
		$conf["variableCheck.checkArguments"]["mustBeFilledVariableName"]=array("var");
3986
		#$conf["variableCheck.checkArguments"]["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double"); 
3986
		#$conf["variableCheck.checkArguments"]["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double");
3987
		$conf["variableCheck.checkArguments"]["mustBeFilledVariableType"]=array(null);
3987
		$conf["variableCheck.checkArguments"]["mustBeFilledVariableType"]=array(null);
3988
		#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
3988
		#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
3989
		$conf["variableCheck.checkArguments"]["referenceVarKey"]="variableCheck.checkArguments";
3989
		$conf["variableCheck.checkArguments"]["referenceVarKey"]="variableCheck.checkArguments";
3990
		#可以省略的參數:
3990
		#可以省略的參數:
3991
		#$conf["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"false"。
3991
		#$conf["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"false"。
3992
		#$conf["canBeEmptyString"]="false";
3992
		#$conf["canBeEmptyString"]="false";
3993
		#$conf["variableCheck.checkArguments"]["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
3993
		#$conf["variableCheck.checkArguments"]["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
3994
		#$conf["variableCheck.checkArguments"]["skipableVariableName"]=array("varPassed");
3994
		#$conf["variableCheck.checkArguments"]["skipableVariableName"]=array("varPassed");
3995
		#$conf["variableCheck.checkArguments"]["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double"); 
3995
		#$conf["variableCheck.checkArguments"]["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
3996
		#$conf["variableCheck.checkArguments"]["skipableVariableType"]=array(null);
3996
		#$conf["variableCheck.checkArguments"]["skipableVariableType"]=array(null);
3997
		#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,"null"代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
3997
		#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,"null"代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
3998
		#$conf["variableCheck.checkArguments"]["skipableVarDefaultValue"]=array(null);
3998
		#$conf["variableCheck.checkArguments"]["skipableVarDefaultValue"]=array(null);
3999
		$checkArguments=variableCheck::checkArguments($conf["variableCheck.checkArguments"]);
3999
		$checkArguments=variableCheck::checkArguments($conf["variableCheck.checkArguments"]);
4000
		unset($conf["variableCheck.checkArguments"]);
4000
		unset($conf["variableCheck.checkArguments"]);
4001
		
4001
 
4002
		#如果 檢查參數 失敗
4002
		#如果 檢查參數 失敗
4003
		if($checkArguments["status"]==="false"){
4003
		if($checkArguments["status"]==="false"){
4004
			
4004
 
4005
			#設置執行不正常
4005
			#設置執行不正常
4006
			$result["status"]="false";
4006
			$result["status"]="false";
4007
			
4007
 
4008
			#設置執行錯誤
4008
			#設置執行錯誤
4009
			$result["error"]=$checkArguments;
4009
			$result["error"]=$checkArguments;
4010
			
4010
 
4011
			#回傳節果
4011
			#回傳節果
4012
			return $result;
4012
			return $result;
4013
			
4013
 
4014
			}#if end
4014
			}#if end
4015
			
4015
 
4016
		#如果 檢查參數 不通過
4016
		#如果 檢查參數 不通過
4017
		if($checkArguments["passed"]==="false"){
4017
		if($checkArguments["passed"]==="false"){
4018
			
4018
 
4019
			#設置執行不正常
4019
			#設置執行不正常
4020
			$result["status"]="false";
4020
			$result["status"]="false";
4021
			
4021
 
4022
			#設置執行錯誤
4022
			#設置執行錯誤
4023
			$result["error"]=$checkArguments;
4023
			$result["error"]=$checkArguments;
4024
			
4024
 
4025
			#回傳節果
4025
			#回傳節果
4026
			return $result;
4026
			return $result;
4027
			
4027
 
4028
			}#if end
4028
			}#if end
4029
			
4029
 
4030
		#函式說明:
4030
		#函式說明:
4031
		#記錄程式輸出的結果.
4031
		#記錄程式輸出的結果.
4032
		#回傳結果:
4032
		#回傳結果:
4033
		#$result["status"],爲查詢是否成功,若爲"true"則成功,若爲"false"則表示失敗了.
4033
		#$result["status"],爲查詢是否成功,若爲"true"則成功,若爲"false"則表示失敗了.
4034
		#$result["error"],錯誤訊息.
4034
		#$result["error"],錯誤訊息.
Line 4045... Line 4045...
4045
		#無.
4045
		#無.
4046
		#備註:
4046
		#備註:
4047
		#無.
4047
		#無.
4048
		$getOutput=record::getOutput($conf["record::getOutput"]);
4048
		$getOutput=record::getOutput($conf["record::getOutput"]);
4049
		unset($conf["record::getOutput"]);
4049
		unset($conf["record::getOutput"]);
4050
	
4050
 
4051
		#如果執行失敗
4051
		#如果執行失敗
4052
		if($getOutput["status"]==="false"){
4052
		if($getOutput["status"]==="false"){
4053
			
4053
 
4054
			#設置錯誤識別
4054
			#設置錯誤識別
4055
			$result["status"]="false";
4055
			$result["status"]="false";
4056
			
4056
 
4057
			#設置錯誤訊息
4057
			#設置錯誤訊息
4058
			$result["error"]=$getOutput;
4058
			$result["error"]=$getOutput;
4059
			
4059
 
4060
			#回傳結果
4060
			#回傳結果
4061
			return $result;
4061
			return $result;
4062
			
4062
 
4063
			}#if end
4063
			}#if end
4064
	
4064
 
4065
		#取得輸出
4065
		#取得輸出
4066
		$result["content"]=$getOutput["content"];
4066
		$result["content"]=$getOutput["content"];
4067
		
4067
 
4068
		#設置執行正常
4068
		#設置執行正常
4069
		$result["status"]="true";
4069
		$result["status"]="true";
4070
		
4070
 
4071
		#回傳結果
4071
		#回傳結果
4072
		return $result;
4072
		return $result;
4073
	
4073
 
4074
		}#functino toSource end
4074
		}#functino toSource end
4075
 
4075
 
4076
	/*
4076
	/*
4077
	#函式說明:
4077
	#函式說明:
4078
	#隱藏元素中可能含有機密的內容.
4078
	#隱藏元素中可能含有機密的內容.
Line 4093... Line 4093...
4093
	#無.
4093
	#無.
4094
	#備註:
4094
	#備註:
4095
	#目前不支援物件.
4095
	#目前不支援物件.
4096
	*/
4096
	*/
4097
	public static function hideParams(&$conf){
4097
	public static function hideParams(&$conf){
4098
	
4098
 
4099
		#取得當前執行的函式
4099
		#取得當前執行的函式
4100
		$result["function"]=__FUNCTION__;
4100
		$result["function"]=__FUNCTION__;
4101
 
4101
 
4102
		#取得使用的參數
4102
		#取得使用的參數
4103
		$result["argu"]=$conf;
4103
		$result["argu"]=$conf;
Line 4154... Line 4154...
4154
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
4154
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
4155
		unset($conf["variableCheck::checkArguments"]);
4155
		unset($conf["variableCheck::checkArguments"]);
4156
 
4156
 
4157
		#若執行失敗
4157
		#若執行失敗
4158
		if($checkArguments["status"]==="false"){
4158
		if($checkArguments["status"]==="false"){
4159
		
4159
 
4160
			#設置執行失敗
4160
			#設置執行失敗
4161
			$result["status"]="false";
4161
			$result["status"]="false";
4162
		
4162
 
4163
			#設置錯誤訊息
4163
			#設置錯誤訊息
4164
			$result["error"]=$checkArguments;
4164
			$result["error"]=$checkArguments;
4165
				
4165
 
4166
			#回傳內容
4166
			#回傳內容
4167
			return $reuslt;
4167
			return $reuslt;
4168
		
4168
 
4169
			}#if end
4169
			}#if end
4170
 
4170
 
4171
		#若檢查不通過
4171
		#若檢查不通過
4172
		if($checkArguments["passed"]==="false"){
4172
		if($checkArguments["passed"]==="false"){
4173
		
4173
 
4174
			#設置執行失敗
4174
			#設置執行失敗
4175
			$result["status"]="false";
4175
			$result["status"]="false";
4176
		
4176
 
4177
			#設置錯誤訊息
4177
			#設置錯誤訊息
4178
			$result["error"]=$checkArguments;
4178
			$result["error"]=$checkArguments;
4179
				
4179
 
4180
			#回傳內容
4180
			#回傳內容
4181
			return $result;
4181
			return $result;
4182
		
4182
 
4183
			}#if end
4183
			}#if end
4184
 
4184
 
4185
		#初始化待處理的陣列變數
4185
		#初始化待處理的陣列變數
4186
		$unprocessedArray=array(&$conf["params"]);
4186
		$unprocessedArray=array(&$conf["params"]);
4187
 
4187
 
4188
		#針對陣列中每個元素
4188
		#針對陣列中每個元素
4189
		while(isset($unprocessedArray[0])){
4189
		while(isset($unprocessedArray[0])){
4190
		
4190
 
4191
			/*
4191
			/*
4192
			#debug
4192
			#debug
4193
			echo "<p>";
4193
			echo "<p>";
4194
			var_dump($unprocessedArray);
4194
			var_dump($unprocessedArray);
4195
			*/
4195
			*/
4196
		
4196
 
4197
			#取得當前元素
4197
			#取得當前元素
4198
			$element=&$unprocessedArray[0];
4198
			$element=&$unprocessedArray[0];
4199
		
4199
 
4200
			/*
4200
			/*
4201
			#debug
4201
			#debug
4202
			echo "<br>";
4202
			echo "<br>";
4203
			var_dump(gettype($element));
4203
			var_dump(gettype($element));
4204
			*/
4204
			*/
4205
		
4205
 
4206
			#如果元素為陣列
4206
			#如果元素為陣列
4207
			if(gettype($element)==="array"){
4207
			if(gettype($element)==="array"){
4208
		
4208
 
4209
				#針對每個變數
4209
				#針對每個變數
4210
				foreach($element as $arrayKey=>$arrayVal){
4210
				foreach($element as $arrayKey=>$arrayVal){
4211
				
4211
 
4212
					/*
4212
					/*
4213
					#debug
4213
					#debug
4214
					echo "<p>";
4214
					echo "<p>";
4215
					echo "foreach in \$element, key=".$arrayKey."<br>";
4215
					echo "foreach in \$element, key=".$arrayKey."<br>";
4216
					echo "content of \$element:".print_r($element,true);
4216
					echo "content of \$element:".print_r($element,true);
4217
									
4217
 
4218
					#debug
4218
					#debug
4219
					echo "<p>";
4219
					echo "<p>";
4220
					echo "check key:".$arrayKey;
4220
					echo "check key:".$arrayKey;
4221
					*/
4221
					*/
4222
				
4222
 
4223
					#函式說明:
4223
					#函式說明:
4224
					#檢查一個字串裡面是否有多個關鍵字
4224
					#檢查一個字串裡面是否有多個關鍵字
4225
					#回傳結果:
4225
					#回傳結果:
4226
					#$result["status"],"true"代表執行成功,"false"代表執行失敗.
4226
					#$result["status"],"true"代表執行成功,"false"代表執行失敗.
4227
					#$result["error"],錯誤訊息.
4227
					#$result["error"],錯誤訊息.
Line 4242... Line 4242...
4242
					#無.
4242
					#無.
4243
					#備註:
4243
					#備註:
4244
					#無.
4244
					#無.
4245
					$findManyKeyWords=search::findManyKeyWords($conf["search::findManyKeyWords"]);
4245
					$findManyKeyWords=search::findManyKeyWords($conf["search::findManyKeyWords"]);
4246
					unset($conf["search::findManyKeyWords"]);
4246
					unset($conf["search::findManyKeyWords"]);
4247
				
4247
 
4248
					/*
4248
					/*
4249
					#debug
4249
					#debug
4250
					echo "<p>";
4250
					echo "<p>";
4251
					echo "content of \$findManyKeyWords:<br>";
4251
					echo "content of \$findManyKeyWords:<br>";
4252
					var_dump($findManyKeyWords);
4252
					var_dump($findManyKeyWords);
4253
					*/
4253
					*/
4254
				
4254
 
4255
					#若執行失敗
4255
					#若執行失敗
4256
					if($findManyKeyWords["status"]==="false"){
4256
					if($findManyKeyWords["status"]==="false"){
4257
					
4257
 
4258
						#設置執行失敗
4258
						#設置執行失敗
4259
						$result["status"]="false";
4259
						$result["status"]="false";
4260
					
4260
 
4261
						#設置錯誤訊息
4261
						#設置錯誤訊息
4262
						$result["error"]=$findManyKeyWords;
4262
						$result["error"]=$findManyKeyWords;
4263
							
4263
 
4264
						#回傳內容
4264
						#回傳內容
4265
						return $reuslt;
4265
						return $reuslt;
4266
					
4266
 
4267
						}#if end
4267
						}#if end
4268
						
4268
 
4269
					#若有符合的關鍵字
4269
					#若有符合的關鍵字
4270
					if($findManyKeyWords["founded"]==="true"){
4270
					if($findManyKeyWords["founded"]==="true"){
4271
					
4271
 
4272
						/*
4272
						/*
4273
						#deubg
4273
						#deubg
4274
						echo "<p>";
4274
						echo "<p>";
4275
						echo "置換 key 為 ".$arrayKey." 者的內容為 ".$conf["changedTo"];
4275
						echo "置換 key 為 ".$arrayKey." 者的內容為 ".$conf["changedTo"];
4276
						*/
4276
						*/
4277
					
4277
 
4278
						#替換其內容
4278
						#替換其內容
4279
						$element[$arrayKey]=$conf["changedTo"];
4279
						$element[$arrayKey]=$conf["changedTo"];
4280
					
4280
 
4281
						/*
4281
						/*
4282
						#debug
4282
						#debug
4283
						echo "<p>";
4283
						echo "<p>";
4284
						echo "替換其內容後 為 ".print_r($element,true);
4284
						echo "替換其內容後 為 ".print_r($element,true);
4285
						*/
4285
						*/
4286
						
4286
 
4287
						#針對下個元素
4287
						#針對下個元素
4288
						continue;
4288
						continue;
4289
					
4289
 
4290
						}#if end
4290
						}#if end
4291
				
4291
 
4292
					#如果數值為陣列
4292
					#如果數值為陣列
4293
					if(gettype($arrayVal)==="array"){
4293
					if(gettype($arrayVal)==="array"){
4294
					
4294
 
4295
						/*
4295
						/*
4296
						#deubg
4296
						#deubg
4297
						echo "<p>";
4297
						echo "<p>";
4298
						echo "新增待處理的陣列 其 key 為 ".$arrayKey;
4298
						echo "新增待處理的陣列 其 key 為 ".$arrayKey;
4299
						*/
4299
						*/
4300
					
4300
 
4301
						#儲存到待處理的陣列中
4301
						#儲存到待處理的陣列中
4302
						$unprocessedArray[]=&$element[$arrayKey];
4302
						$unprocessedArray[]=&$element[$arrayKey];
4303
						
4303
 
4304
						/*
4304
						/*
4305
						#debug
4305
						#debug
4306
						echo "<p>";
4306
						echo "<p>";
4307
						echo "新增待處理的陣列後 其 內容 為 ".print_r($unprocessedArray,true);
4307
						echo "新增待處理的陣列後 其 內容 為 ".print_r($unprocessedArray,true);
4308
						*/
4308
						*/
4309
					
4309
 
4310
						}#if end
4310
						}#if end
4311
				
4311
 
4312
					}#foreach end
4312
					}#foreach end
4313
 
4313
 
4314
				}#if end
4314
				}#if end
4315
			
4315
 
4316
			/*
4316
			/*
4317
			#debug
4317
			#debug
4318
			echo "<br>";
4318
			echo "<br>";
4319
			echo "before array_shift, count of \$unprocessedArray:".count($unprocessedArray);
4319
			echo "before array_shift, count of \$unprocessedArray:".count($unprocessedArray);
4320
			echo "<br>";
4320
			echo "<br>";
4321
			var_dump($unprocessedArray);
4321
			var_dump($unprocessedArray);
4322
			*/
4322
			*/
4323
			
4323
 
4324
			#將第一個元素移除
4324
			#將第一個元素移除
4325
			array_shift($unprocessedArray);
4325
			array_shift($unprocessedArray);
4326
			
4326
 
4327
			/*
4327
			/*
4328
			#debug
4328
			#debug
4329
			echo "<br>";
4329
			echo "<br>";
4330
			echo "after array_shift, count of \$unprocessedArray:".count($unprocessedArray);
4330
			echo "after array_shift, count of \$unprocessedArray:".count($unprocessedArray);
4331
			echo "<br>";
4331
			echo "<br>";
4332
			var_dump($unprocessedArray);
4332
			var_dump($unprocessedArray);
4333
			echo "<hr>";
4333
			echo "<hr>";
4334
			*/
4334
			*/
4335
		
4335
 
4336
			}#while end
4336
			}#while end
4337
 
4337
 
4338
		#設置回傳內容
4338
		#設置回傳內容
4339
		$result["content"]=$conf["params"];
4339
		$result["content"]=$conf["params"];
4340
 
4340
 
4341
		#設置執行正常
4341
		#設置執行正常
4342
		$result["status"]="true";
4342
		$result["status"]="true";
4343
 
4343
 
4344
		#回傳結果
4344
		#回傳結果
4345
		return $result;
4345
		return $result;
4346
	
4346
 
4347
		}#function hideParams end
4347
		}#function hideParams end
4348
 
4348
 
4349
	/*
4349
	/*
4350
	#函式說明:
4350
	#函式說明:
4351
	#取得簡單的錯誤訊息
4351
	#取得簡單的錯誤訊息
Line 4363... Line 4363...
4363
	#無.
4363
	#無.
4364
	#備註:
4364
	#備註:
4365
	#無.
4365
	#無.
4366
	*/
4366
	*/
4367
	public static function getSimpleError(&$conf){
4367
	public static function getSimpleError(&$conf){
4368
	
4368
 
4369
		#var_dump($conf);
4369
		#var_dump($conf);
4370
	
4370
 
4371
		#初始化要回傳的結果
4371
		#初始化要回傳的結果
4372
		$result=array();
4372
		$result=array();
4373
 
4373
 
4374
		#取得當前執行的函數名稱
4374
		#取得當前執行的函數名稱
4375
		$result["function"]=__FUNCTION__;
4375
		$result["function"]=__FUNCTION__;
Line 4383... Line 4383...
4383
			#設置執行錯誤訊息
4383
			#設置執行錯誤訊息
4384
			$result["error"]="函數".$result["function"]."需要參數";
4384
			$result["error"]="函數".$result["function"]."需要參數";
4385
 
4385
 
4386
			#無窮迴圈
4386
			#無窮迴圈
4387
			while(true){
4387
			while(true){
4388
			
4388
 
4389
				#遞迴執行
4389
				#遞迴執行
4390
				$conf["self::getSimpleError"]["error"]=$result;
4390
				$conf["self::getSimpleError"]["error"]=$result;
4391
				$simpleError=self::getSimpleError($conf["self::getSimpleError"]);
4391
				$simpleError=self::getSimpleError($conf["self::getSimpleError"]);
4392
				unset($conf["self::getSimpleError"]);
4392
				unset($conf["self::getSimpleError"]);
4393
			
4393
 
4394
				#如果執行失敗
4394
				#如果執行失敗
4395
				if($simpleError["status"]==="false"){
4395
				if($simpleError["status"]==="false"){
4396
				
4396
 
4397
					#設置執行失敗
4397
					#設置執行失敗
4398
					$result["status"]="false";
4398
					$result["status"]="false";
4399
 
4399
 
4400
					#設置執行錯誤訊息
4400
					#設置執行錯誤訊息
4401
					$result["error"]=$simpleError;
4401
					$result["error"]=$simpleError;
4402
					
4402
 
4403
					#下一輪
4403
					#下一輪
4404
					continue;
4404
					continue;
4405
				
4405
 
4406
					}#if end
4406
					}#if end
4407
			
4407
 
4408
				#結束 while
4408
				#結束 while
4409
				break;
4409
				break;
4410
			
4410
 
4411
				}#while end
4411
				}#while end
4412
 
4412
 
4413
			return $result;
4413
			return $result;
4414
 
4414
 
4415
			}#if end
4415
			}#if end
Line 4431... Line 4431...
4431
 
4431
 
4432
				#設置執行錯誤訊息
4432
				#設置執行錯誤訊息
4433
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
4433
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
4434
 
4434
 
4435
				}#if end
4435
				}#if end
4436
				
4436
 
4437
			#無窮迴圈
4437
			#無窮迴圈
4438
			while(true){
4438
			while(true){
4439
			
4439
 
4440
				#遞迴執行
4440
				#遞迴執行
4441
				$conf["self::getSimpleError"]["error"]=$result;
4441
				$conf["self::getSimpleError"]["error"]=$result;
4442
				$simpleError=self::getSimpleError($conf["self::getSimpleError"]);
4442
				$simpleError=self::getSimpleError($conf["self::getSimpleError"]);
4443
				unset($conf["self::getSimpleError"]);
4443
				unset($conf["self::getSimpleError"]);
4444
			
4444
 
4445
				#如果執行失敗
4445
				#如果執行失敗
4446
				if($simpleError["status"]==="false"){
4446
				if($simpleError["status"]==="false"){
4447
				
4447
 
4448
					#設置執行失敗
4448
					#設置執行失敗
4449
					$result["status"]="false";
4449
					$result["status"]="false";
4450
 
4450
 
4451
					#設置執行錯誤訊息
4451
					#設置執行錯誤訊息
4452
					$result["error"]=$simpleError;
4452
					$result["error"]=$simpleError;
4453
					
4453
 
4454
					#下一輪
4454
					#下一輪
4455
					continue;
4455
					continue;
4456
				
4456
 
4457
					}#if end
4457
					}#if end
4458
			
4458
 
4459
				#結束 while
4459
				#結束 while
4460
				break;
4460
				break;
4461
			
4461
 
4462
				}#while end
4462
				}#while end
4463
 
4463
 
4464
			#回傳結果
4464
			#回傳結果
4465
			return $result;
4465
			return $result;
4466
 
4466
 
4467
			}#if end
4467
			}#if end
4468
	
4468
 
4469
		#函式說明:
4469
		#函式說明:
4470
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
4470
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
4471
		#回傳結果:
4471
		#回傳結果:
4472
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4472
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4473
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
4473
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 4515... Line 4515...
4515
		#array_keys=>http://php.net/manual/en/function.array-keys.php
4515
		#array_keys=>http://php.net/manual/en/function.array-keys.php
4516
		#備註:
4516
		#備註:
4517
		#無.
4517
		#無.
4518
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
4518
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
4519
		unset($conf["variableCheck::checkArguments"]);
4519
		unset($conf["variableCheck::checkArguments"]);
4520
		
4520
 
4521
		#如果執行失敗
4521
		#如果執行失敗
4522
		if($checkArguments["status"]==="false"){
4522
		if($checkArguments["status"]==="false"){
4523
		
4523
 
4524
			#設置執行失敗
4524
			#設置執行失敗
4525
			$result["status"]="false";
4525
			$result["status"]="false";
4526
 
4526
 
4527
			#設置執行錯誤訊息
4527
			#設置執行錯誤訊息
4528
			$result["error"]=$checkArguments;
4528
			$result["error"]=$checkArguments;
4529
 
4529
 
4530
			#無窮迴圈
4530
			#無窮迴圈
4531
			while(true){
4531
			while(true){
4532
			
4532
 
4533
				#遞迴執行
4533
				#遞迴執行
4534
				$conf["self::getSimpleError"]["error"]=$result;
4534
				$conf["self::getSimpleError"]["error"]=$result;
4535
				$simpleError=self::getSimpleError($conf["self::getSimpleError"]);
4535
				$simpleError=self::getSimpleError($conf["self::getSimpleError"]);
4536
				unset($conf["self::getSimpleError"]);
4536
				unset($conf["self::getSimpleError"]);
4537
			
4537
 
4538
				#如果執行失敗
4538
				#如果執行失敗
4539
				if($simpleError["status"]==="false"){
4539
				if($simpleError["status"]==="false"){
4540
				
4540
 
4541
					#設置執行失敗
4541
					#設置執行失敗
4542
					$result["status"]="false";
4542
					$result["status"]="false";
4543
 
4543
 
4544
					#設置執行錯誤訊息
4544
					#設置執行錯誤訊息
4545
					$result["error"]=$simpleError;
4545
					$result["error"]=$simpleError;
4546
					
4546
 
4547
					#下一輪
4547
					#下一輪
4548
					continue;
4548
					continue;
4549
				
4549
 
4550
					}#if end
4550
					}#if end
4551
					
4551
 
4552
				#如果檢查不通過
4552
				#如果檢查不通過
4553
				if($simpleError["passed"]==="false"){
4553
				if($simpleError["passed"]==="false"){
4554
				
4554
 
4555
					#設置執行失敗
4555
					#設置執行失敗
4556
					$result["status"]="false";
4556
					$result["status"]="false";
4557
 
4557
 
4558
					#設置執行錯誤訊息
4558
					#設置執行錯誤訊息
4559
					$result["error"]=$simpleError;
4559
					$result["error"]=$simpleError;
4560
					
4560
 
4561
					#下一輪
4561
					#下一輪
4562
					continue;
4562
					continue;
4563
				
4563
 
4564
					}#if end
4564
					}#if end
4565
			
4565
 
4566
				#結束 while
4566
				#結束 while
4567
				break;
4567
				break;
4568
			
4568
 
4569
				}#while end
4569
				}#while end
4570
 
4570
 
4571
			#取得 simpleError
4571
			#取得 simpleError
4572
			$result["simpleError"]=$simpleError["content"];
4572
			$result["simpleError"]=$simpleError["content"];
4573
 
4573
 
4574
			#回傳結果
4574
			#回傳結果
4575
			return $result;
4575
			return $result;
4576
		
4576
 
4577
			}#if end
4577
			}#if end
4578
			
4578
 
4579
		#如果執行失敗
4579
		#如果執行失敗
4580
		if($checkArguments["passed"]==="false"){
4580
		if($checkArguments["passed"]==="false"){
4581
		
4581
 
4582
			#設置執行失敗
4582
			#設置執行失敗
4583
			$result["status"]="false";
4583
			$result["status"]="false";
4584
 
4584
 
4585
			#設置執行錯誤訊息
4585
			#設置執行錯誤訊息
4586
			$result["error"]=$checkArguments;
4586
			$result["error"]=$checkArguments;
4587
			
4587
 
4588
			#無窮迴圈
4588
			#無窮迴圈
4589
			while(true){
4589
			while(true){
4590
			
4590
 
4591
				#遞迴執行
4591
				#遞迴執行
4592
				$conf["self::getSimpleError"]["error"]=$result;
4592
				$conf["self::getSimpleError"]["error"]=$result;
4593
				$simpleError=self::getSimpleError($conf["self::getSimpleError"]);
4593
				$simpleError=self::getSimpleError($conf["self::getSimpleError"]);
4594
				unset($conf["self::getSimpleError"]);
4594
				unset($conf["self::getSimpleError"]);
4595
			
4595
 
4596
				#如果執行失敗
4596
				#如果執行失敗
4597
				if($simpleError["status"]==="false"){
4597
				if($simpleError["status"]==="false"){
4598
				
4598
 
4599
					#設置執行失敗
4599
					#設置執行失敗
4600
					$result["status"]="false";
4600
					$result["status"]="false";
4601
 
4601
 
4602
					#設置執行錯誤訊息
4602
					#設置執行錯誤訊息
4603
					$result["error"]=$simpleError;
4603
					$result["error"]=$simpleError;
4604
					
4604
 
4605
					#下一輪
4605
					#下一輪
4606
					continue;
4606
					continue;
4607
				
4607
 
4608
					}#if end
4608
					}#if end
4609
					
4609
 
4610
				#如果檢查不通過
4610
				#如果檢查不通過
4611
				if($simpleError["passed"]==="false"){
4611
				if($simpleError["passed"]==="false"){
4612
				
4612
 
4613
					#設置執行失敗
4613
					#設置執行失敗
4614
					$result["status"]="false";
4614
					$result["status"]="false";
4615
 
4615
 
4616
					#設置執行錯誤訊息
4616
					#設置執行錯誤訊息
4617
					$result["error"]=$simpleError;
4617
					$result["error"]=$simpleError;
4618
					
4618
 
4619
					#下一輪
4619
					#下一輪
4620
					continue;
4620
					continue;
4621
				
4621
 
4622
					}#if end
4622
					}#if end
4623
			
4623
 
4624
				#結束 while
4624
				#結束 while
4625
				break;
4625
				break;
4626
			
4626
 
4627
				}#while end
4627
				}#while end
4628
 
4628
 
4629
			#取得 simpleError
4629
			#取得 simpleError
4630
			$result["simpleError"]=$simpleError["content"];
4630
			$result["simpleError"]=$simpleError["content"];
4631
 
4631
 
4632
			#回傳結果
4632
			#回傳結果
4633
			return $result;
4633
			return $result;
4634
		
4634
 
4635
			}#if end
4635
			}#if end
4636
		
4636
 
4637
		#var_dump($result);
4637
		#var_dump($result);
4638
		
4638
 
4639
		#初始化簡單的錯誤
4639
		#初始化簡單的錯誤
4640
		$result["content"]=&$conf["error"];
4640
		$result["content"]=&$conf["error"];
4641
 
4641
 
4642
		#如果底下有 error 元素
4642
		#如果底下有 error 元素
4643
		while(isset($result["content"]["error"])){
4643
		while(isset($result["content"]["error"])){
4644
		
4644
 
4645
			#var_dump($result["content"]["error"]);
4645
			#var_dump($result["content"]["error"]);
4646
		
4646
 
4647
			#取得其位置
4647
			#取得其位置
4648
			$result["content"]=&$result["content"]["error"];
4648
			$result["content"]=&$result["content"]["error"];
4649
					
4649
 
4650
			}#while end
4650
			}#while end
4651
		
4651
 
4652
		#初始化新的結果
4652
		#初始化新的結果
4653
		$newContentStr="";
4653
		$newContentStr="";
4654
		
4654
 
4655
		#如果 content 不是字串
4655
		#如果 content 不是字串
4656
		if(gettype($result["content"])!=="string"){
4656
		if(gettype($result["content"])!=="string"){
4657
		
4657
 
4658
			#var_dump($result["content"]);
4658
			#var_dump($result["content"]);
4659
		
4659
 
4660
			#針對每個錯誤訊息
4660
			#針對每個錯誤訊息
4661
			foreach($result["content"] as $errorLine){
4661
			foreach($result["content"] as $errorLine){
4662
			
4662
 
4663
				#如果不是字串
4663
				#如果不是字串
4664
				if(gettype($errorLine)!=="string"){
4664
				if(gettype($errorLine)!=="string"){
4665
				
4665
 
4666
					#將陣列轉換成字串
4666
					#將陣列轉換成字串
4667
					$errorLine=print_r($errorLine,true);
4667
					$errorLine=print_r($errorLine,true);
4668
				
4668
 
4669
					}#if end
4669
					}#if end
4670
			
4670
 
4671
				#串接結果
4671
				#串接結果
4672
				$newContentStr=$newContentStr.$errorLine.PHP_EOL;
4672
				$newContentStr=$newContentStr.$errorLine.PHP_EOL;
4673
			
4673
 
4674
				}#foreache end
4674
				}#foreache end
4675
		
4675
 
4676
			}#if end		
4676
			}#if end
4677
		
4677
 
4678
		#設置結果內容
4678
		#設置結果內容
4679
		$result["content"]=$newContentStr;
4679
		$result["content"]=$newContentStr;
4680
		
4680
 
4681
		#設置執行正常
4681
		#設置執行正常
4682
		$result["status"]=true;
4682
		$result["status"]=true;
4683
	
4683
 
4684
		#回傳結果
4684
		#回傳結果
4685
		return $result;
4685
		return $result;
4686
	
4686
 
4687
		}#function getSimpleError end
4687
		}#function getSimpleError end
4688
		
4688
 
4689
	/*
4689
	/*
4690
	#函式說明:
4690
	#函式說明:
4691
	#檢查字串是否符合指定格式
4691
	#檢查字串是否符合指定格式
4692
	#回傳結果:
4692
	#回傳結果:
4693
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4693
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 4720... Line 4720...
4720
	#grapheme_substr=>https://www.php.net/manual/en/function.grapheme-substr.php
4720
	#grapheme_substr=>https://www.php.net/manual/en/function.grapheme-substr.php
4721
	#備註:
4721
	#備註:
4722
	#無.
4722
	#無.
4723
	*/
4723
	*/
4724
	public static function checkStringFormat(&$conf){
4724
	public static function checkStringFormat(&$conf){
4725
	
4725
 
4726
		#初始化要回傳的內容
4726
		#初始化要回傳的內容
4727
		$result=array();
4727
		$result=array();
4728
 
4728
 
4729
		#取得當前執行的函數名稱
4729
		#取得當前執行的函數名稱
4730
		$result["function"]=__FUNCTION__;
4730
		$result["function"]=__FUNCTION__;
4731
 
4731
 
4732
		#如果 $conf 不為陣列
4732
		#如果 $conf 不為陣列
4733
		if(gettype($conf)!="array"){
4733
		if(gettype($conf)!="array"){
4734
			
4734
 
4735
			#設置執行失敗
4735
			#設置執行失敗
4736
			$result["status"]="false";
4736
			$result["status"]="false";
4737
			
4737
 
4738
			#設置執行錯誤訊息
4738
			#設置執行錯誤訊息
4739
			$result["error"][]="\$conf變數須為陣列形態";
4739
			$result["error"][]="\$conf變數須為陣列形態";
4740
 
4740
 
4741
			#如果傳入的參數為 null
4741
			#如果傳入的參數為 null
4742
			if($conf==null){
4742
			if($conf==null){
4743
				
4743
 
4744
				#設置執行錯誤訊息
4744
				#設置執行錯誤訊息
4745
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
4745
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
4746
				
4746
 
4747
				}#if end
4747
				}#if end
4748
 
4748
 
4749
			#回傳結果
4749
			#回傳結果
4750
			return $result;
4750
			return $result;
4751
			
4751
 
4752
			}#if end
4752
			}#if end
4753
			
4753
 
4754
		#取得參數
4754
		#取得參數
4755
		$result["argu"]=$conf;
4755
		$result["argu"]=$conf;
4756
 
4756
 
4757
		#函式說明:
4757
		#函式說明:
4758
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
4758
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
Line 4806... Line 4806...
4806
		#array_keys=>http://php.net/manual/en/function.array-keys.php
4806
		#array_keys=>http://php.net/manual/en/function.array-keys.php
4807
		#備註:
4807
		#備註:
4808
		#無.
4808
		#無.
4809
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
4809
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
4810
		unset($conf["variableCheck::checkArguments"]);
4810
		unset($conf["variableCheck::checkArguments"]);
4811
	
4811
 
4812
		#如果檢查失敗
4812
		#如果檢查失敗
4813
		if($checkArguments["status"]==="false"){
4813
		if($checkArguments["status"]==="false"){
4814
			
4814
 
4815
			#設置錯誤識別
4815
			#設置錯誤識別
4816
			$result["status"]="false";
4816
			$result["status"]="false";
4817
			
4817
 
4818
			#設置錯誤訊息
4818
			#設置錯誤訊息
4819
			$result["error"]=$checkArguments;
4819
			$result["error"]=$checkArguments;
4820
			
4820
 
4821
			#回傳結果
4821
			#回傳結果
4822
			return $result;
4822
			return $result;
4823
			
4823
 
4824
			}#if end
4824
			}#if end
4825
		
4825
 
4826
		#如果檢查不通過
4826
		#如果檢查不通過
4827
		if($checkArguments["passed"]==="false"){
4827
		if($checkArguments["passed"]==="false"){
4828
			
4828
 
4829
			#設置錯誤識別
4829
			#設置錯誤識別
4830
			$result["status"]="false";
4830
			$result["status"]="false";
4831
			
4831
 
4832
			#設置錯誤訊息
4832
			#設置錯誤訊息
4833
			$result["error"]=$checkArguments;
4833
			$result["error"]=$checkArguments;
4834
			
4834
 
4835
			#回傳結果
4835
			#回傳結果
4836
			return $result;
4836
			return $result;
4837
			
4837
 
4838
			}#if end
4838
			}#if end
4839
		
4839
 
4840
		#預設剩下未檢查格式的input為空字串
4840
		#預設剩下未檢查格式的input為空字串
4841
		$result["newInputArgu"]="";
4841
		$result["newInputArgu"]="";
4842
		
4842
 
4843
		#如果存在分段的格式設定
4843
		#如果存在分段的格式設定
4844
		if(isset($conf["section"])){
4844
		if(isset($conf["section"])){
4845
		
4845
 
4846
			#預設都是尚未檢驗的字串
4846
			#預設都是尚未檢驗的字串
4847
			$newInputArgu=$conf["input"];
4847
			$newInputArgu=$conf["input"];
4848
		
4848
 
4849
			#針對每段
4849
			#針對每段
4850
			foreach($conf["section"] as $index => $sec){
4850
			foreach($conf["section"] as $index => $sec){
4851
			
4851
 
4852
				#更新input參數
4852
				#更新input參數
4853
				$sec["input"]=$newInputArgu;
4853
				$sec["input"]=$newInputArgu;
4854
			
4854
 
4855
				#處理該section
4855
				#處理該section
4856
				#函式說明:
4856
				#函式說明:
4857
				#檢查字串是否符合指定格式
4857
				#檢查字串是否符合指定格式
4858
				#回傳結果:
4858
				#回傳結果:
4859
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4859
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 4876... Line 4876...
4876
				#$conf["centerWith"]="";
4876
				#$conf["centerWith"]="";
4877
				#$conf["length"],字串整數,字串的長度要多少(bytes).
4877
				#$conf["length"],字串整數,字串的長度要多少(bytes).
4878
				#$conf["length"]="";
4878
				#$conf["length"]="";
4879
				#$conf["lengthGrapheme"],字串整數,字串的長度要多少字位(grapheme).
4879
				#$conf["lengthGrapheme"],字串整數,字串的長度要多少字位(grapheme).
4880
				#$conf["lengthGrapheme"]="";
4880
				#$conf["lengthGrapheme"]="";
4881
				#$conf["variableCheck::checkStringFormat"]["section"]=$nextSectionArgu;				
4881
				#$conf["variableCheck::checkStringFormat"]["section"]=$nextSectionArgu;
4882
				#參考資料:
4882
				#參考資料:
4883
				#grapheme_strlen=>https://www.php.net/manual/en/function.grapheme-strlen.php
4883
				#grapheme_strlen=>https://www.php.net/manual/en/function.grapheme-strlen.php
4884
				#grapheme/字位/可以書寫的最小單位=>https://zh.wikipedia.org/zh-tw/%E5%AD%97%E4%BD%8D
4884
				#grapheme/字位/可以書寫的最小單位=>https://zh.wikipedia.org/zh-tw/%E5%AD%97%E4%BD%8D
4885
				#備註:
4885
				#備註:
4886
				#無.
4886
				#無.
4887
				$conf["variableCheck::checkStringFormat"]=$sec;
4887
				$conf["variableCheck::checkStringFormat"]=$sec;
4888
				$checkStringFormat=variableCheck::checkStringFormat($conf["variableCheck::checkStringFormat"]);
4888
				$checkStringFormat=variableCheck::checkStringFormat($conf["variableCheck::checkStringFormat"]);
4889
				unset($conf["variableCheck::checkStringFormat"]);
4889
				unset($conf["variableCheck::checkStringFormat"]);
4890
				
4890
 
4891
				#如果執行失敗
4891
				#如果執行失敗
4892
				if($checkStringFormat["status"]=="false"){
4892
				if($checkStringFormat["status"]=="false"){
4893
					
4893
 
4894
					#設置錯誤識別
4894
					#設置錯誤識別
4895
					$result["status"]="false";
4895
					$result["status"]="false";
4896
					
4896
 
4897
					#設置錯誤訊息
4897
					#設置錯誤訊息
4898
					$result["error"]=$checkStringFormat;
4898
					$result["error"]=$checkStringFormat;
4899
					
4899
 
4900
					#回傳結果
4900
					#回傳結果
4901
					return $result;
4901
					return $result;
4902
					
4902
 
4903
					}#if end
4903
					}#if end
4904
					
4904
 
4905
				#如果不通過
4905
				#如果不通過
4906
				if($checkStringFormat["passed"]=="false"){
4906
				if($checkStringFormat["passed"]=="false"){
4907
					
4907
 
4908
					#回傳結果
4908
					#回傳結果
4909
					return $checkStringFormat;
4909
					return $checkStringFormat;
4910
					
4910
 
4911
					}#if end
4911
					}#if end
4912
					
4912
 
4913
				#取得新的input參數
4913
				#取得新的input參數
4914
				$newInputArgu=$checkStringFormat["newInputArgu"];
4914
				$newInputArgu=$checkStringFormat["newInputArgu"];
4915
				
4915
 
4916
				}#foreach end
4916
				}#foreach end
4917
		
4917
 
4918
			}#if end
4918
			}#if end
4919
	
4919
 
4920
		#到這邊代表不存在分段的格式設定
4920
		#到這邊代表不存在分段的格式設定
4921
		
4921
 
4922
		#初始化關鍵字
4922
		#初始化關鍵字
4923
		$keywords=array();
4923
		$keywords=array();
4924
		
4924
 
4925
		#如果有 startWith
4925
		#如果有 startWith
4926
		if(isset($conf["startWith"])){
4926
		if(isset($conf["startWith"])){
4927
		
4927
 
4928
			#設置關鍵字
4928
			#設置關鍵字
4929
			$keywords[]=$conf["startWith"];
4929
			$keywords[]=$conf["startWith"];
4930
		
4930
 
4931
			}#if end
4931
			}#if end
4932
			
4932
 
4933
		#如果有 centerWith
4933
		#如果有 centerWith
4934
		if(isset($conf["centerWith"])){
4934
		if(isset($conf["centerWith"])){
4935
		
4935
 
4936
			#設置關鍵字
4936
			#設置關鍵字
4937
			$keywords[]=$conf["centerWith"];
4937
			$keywords[]=$conf["centerWith"];
4938
		
4938
 
4939
			}#if end
4939
			}#if end
4940
			
4940
 
4941
		#如果有 endWith
4941
		#如果有 endWith
4942
		if(isset($conf["endWith"])){
4942
		if(isset($conf["endWith"])){
4943
		
4943
 
4944
			#設置關鍵字
4944
			#設置關鍵字
4945
			$keywords[]=$conf["endWith"];
4945
			$keywords[]=$conf["endWith"];
4946
		
4946
 
4947
			}#if end
4947
			}#if end
4948
	
4948
 
4949
		#如果存在關鍵字
4949
		#如果存在關鍵字
4950
		if(!empty($keywords)){
4950
		if(!empty($keywords)){
4951
		
4951
 
4952
			#若有指定bytes長度
4952
			#若有指定bytes長度
4953
			if(isset($conf["length"])){
4953
			if(isset($conf["length"])){
4954
			
4954
 
4955
				#取得輸入的字串長度
4955
				#取得輸入的字串長度
4956
				$length=strlen($conf["input"]);
4956
				$length=strlen($conf["input"]);
4957
			
4957
 
4958
				#如果長度不足
4958
				#如果長度不足
4959
				if($length<(int)$conf["length"]){
4959
				if($length<(int)$conf["length"]){
4960
				
4960
 
4961
					#設置執行正常
4961
					#設置執行正常
4962
					$result["status"]="true";
4962
					$result["status"]="true";
4963
					
4963
 
4964
					#設置檢查不通過
4964
					#設置檢查不通過
4965
					$result["passed"]="false";
4965
					$result["passed"]="false";
4966
					
4966
 
4967
					#設置詳細結果訊息陣列.
4967
					#設置詳細結果訊息陣列.
4968
					$result["content"][]="input參數(".$conf["input"].")的bytes長度(".$length.")小於length參數(".$conf["length"].")";
4968
					$result["content"][]="input參數(".$conf["input"].")的bytes長度(".$length.")小於length參數(".$conf["length"].")";
4969
				
4969
 
4970
					#回傳結果
4970
					#回傳結果
4971
					return $result;
4971
					return $result;
4972
				
4972
 
4973
					}#if end
4973
					}#if end
4974
					
4974
 
4975
				#函式說明:
4975
				#函式說明:
4976
				#unicode的字串分割,比str_split的支援度高.
4976
				#unicode的字串分割,比str_split的支援度高.
4977
				#回傳結果:
4977
				#回傳結果:
4978
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4978
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4979
				#$result["error"],錯誤訊息陣列.	
4979
				#$result["error"],錯誤訊息陣列.
4980
				#$result["function"],當前執行的函數名稱.
4980
				#$result["function"],當前執行的函數名稱.
4981
				#$result["content"],分割好的內容陣列.
4981
				#$result["content"],分割好的內容陣列.
4982
				#$result["length"],unicode字串的長度.
4982
				#$result["length"],unicode字串的長度.
4983
				#必填參數:
4983
				#必填參數:
4984
				#$conf["str"],字串",要分割的字串.
4984
				#$conf["str"],字串",要分割的字串.
Line 4990... Line 4990...
4990
				#http://php.net/manual/en/function.str-split.php
4990
				#http://php.net/manual/en/function.str-split.php
4991
				#備註:
4991
				#備註:
4992
				#無.
4992
				#無.
4993
				$str_split_unicode=stringProcess::str_split_unicode($conf["stringProcess::str_split_unicode"]);
4993
				$str_split_unicode=stringProcess::str_split_unicode($conf["stringProcess::str_split_unicode"]);
4994
				unset($conf["stringProcess::str_split_unicode"]);
4994
				unset($conf["stringProcess::str_split_unicode"]);
4995
					
4995
 
4996
				#如果執行失敗
4996
				#如果執行失敗
4997
				if($str_split_unicode["status"]==="false"){
4997
				if($str_split_unicode["status"]==="false"){
4998
					
4998
 
4999
					#設置執行失敗
4999
					#設置執行失敗
5000
					$result["status"]="false";
5000
					$result["status"]="false";
5001
					
5001
 
5002
					#設置執行錯誤訊息
5002
					#設置執行錯誤訊息
5003
					$result["error"]=$str_split_unicode;
5003
					$result["error"]=$str_split_unicode;
5004
					
5004
 
5005
					#回傳結果
5005
					#回傳結果
5006
					return $result;
5006
					return $result;
5007
					
5007
 
5008
					}#if end	
5008
					}#if end
5009
				
5009
 
5010
				#初始化給search::findKeyWordsPosition的input參數
5010
				#初始化給search::findKeyWordsPosition的input參數
5011
				$newInputArguForFindKeyWordsPosition="";
5011
				$newInputArguForFindKeyWordsPosition="";
5012
				
5012
 
5013
				#初始化給variableCheck::checkStringFormat的input參數
5013
				#初始化給variableCheck::checkStringFormat的input參數
5014
				$newInputArgu="";
5014
				$newInputArgu="";
5015
				
5015
 
5016
				#針對剩下的每個bytes
5016
				#針對剩下的每個bytes
5017
				foreach($str_split_unicode["content"] as $index=>$splitedStr){
5017
				foreach($str_split_unicode["content"] as $index=>$splitedStr){
5018
				
5018
 
5019
					#屬於findKeyWordsPosition的input參數
5019
					#屬於findKeyWordsPosition的input參數
5020
					if($index<(int)$conf["length"]){
5020
					if($index<(int)$conf["length"]){
5021
				
5021
 
5022
						#串接新的input參數bytes
5022
						#串接新的input參數bytes
5023
						$newInputArguForFindKeyWordsPosition=$newInputArguForFindKeyWordsPosition.$splitedStr;
5023
						$newInputArguForFindKeyWordsPosition=$newInputArguForFindKeyWordsPosition.$splitedStr;
5024
				
5024
 
5025
						}#if end
5025
						}#if end
5026
						
5026
 
5027
					#反之
5027
					#反之
5028
					else{
5028
					else{
5029
					
5029
 
5030
						#串接新的input參數bytes
5030
						#串接新的input參數bytes
5031
						$newInputArgu=$newInputArgu.$splitedStr;
5031
						$newInputArgu=$newInputArgu.$splitedStr;
5032
					
5032
 
5033
						}#else end
5033
						}#else end
5034
				
5034
 
5035
					}#foreach end
5035
					}#foreach end
5036
					
5036
 
5037
				}#if end
5037
				}#if end
5038
			
5038
 
5039
			#反之不存在指定bytes長度
5039
			#反之不存在指定bytes長度
5040
			
5040
 
5041
			#但有指定字位長度
5041
			#但有指定字位長度
5042
			else if(isset($conf["lengthGrapheme"])){
5042
			else if(isset($conf["lengthGrapheme"])){
5043
			
5043
 
5044
				#取得輸入的字位長度
5044
				#取得輸入的字位長度
5045
				$grapheme_strlen=grapheme_strlen($conf["input"]);
5045
				$grapheme_strlen=grapheme_strlen($conf["input"]);
5046
			
5046
 
5047
				#如果長度不足
5047
				#如果長度不足
5048
				if($grapheme_strlen>(int)$conf["lengthGrapheme"]){
5048
				if($grapheme_strlen>(int)$conf["lengthGrapheme"]){
5049
				
5049
 
5050
					#設置執行正常
5050
					#設置執行正常
5051
					$result["status"]="true";
5051
					$result["status"]="true";
5052
					
5052
 
5053
					#設置檢查不通過
5053
					#設置檢查不通過
5054
					$result["passed"]="false";
5054
					$result["passed"]="false";
5055
					
5055
 
5056
					#設置詳細結果訊息陣列.
5056
					#設置詳細結果訊息陣列.
5057
					$result["content"][]="input參數(".$conf["input"].")的字位長度(".$grapheme_strlen.")小於lengthGrapheme參數(".$conf["lengthGrapheme"].")";
5057
					$result["content"][]="input參數(".$conf["input"].")的字位長度(".$grapheme_strlen.")小於lengthGrapheme參數(".$conf["lengthGrapheme"].")";
5058
				
5058
 
5059
					#回傳結果
5059
					#回傳結果
5060
					return $result;
5060
					return $result;
5061
				
5061
 
5062
					}#if end
5062
					}#if end
5063
				
5063
 
5064
				#初始化給search::findKeyWordsPosition的input參數
5064
				#初始化給search::findKeyWordsPosition的input參數
5065
				$arguForFindKeyWordsPosition=grapheme_substr($conf["input"],0,$conf["lengthGrapheme"]);
5065
				$arguForFindKeyWordsPosition=grapheme_substr($conf["input"],0,$conf["lengthGrapheme"]);
5066
				
5066
 
5067
				#初始化給variableCheck::checkStringFormat的input參數
5067
				#初始化給variableCheck::checkStringFormat的input參數
5068
				$newInputArgu=grapheme_substr($conf["input"],$conf["lengthGrapheme"]);
5068
				$newInputArgu=grapheme_substr($conf["input"],$conf["lengthGrapheme"]);
5069
				
5069
 
5070
				}#if end
5070
				}#if end
5071
		
5071
 
5072
			#函式說明:
5072
			#函式說明:
5073
			#取得關鍵字在字串的哪個位置(字首,字尾,中間)
5073
			#取得關鍵字在字串的哪個位置(字首,字尾,中間)
5074
			#回傳結果:
5074
			#回傳結果:
5075
			#$result["status"],執行成功與否,若爲"true",代表執行成功,若爲"false"代表執失敗。
5075
			#$result["status"],執行成功與否,若爲"true",代表執行成功,若爲"false"代表執失敗。
5076
			#$result["error"],錯誤訊息陣列.
5076
			#$result["error"],錯誤訊息陣列.
Line 5081... Line 5081...
5081
			#$result["tail"][i],第i個關鍵字是否在字串的尾端,"true"代表是,"false"代表不是.
5081
			#$result["tail"][i],第i個關鍵字是否在字串的尾端,"true"代表是,"false"代表不是.
5082
			#$result["center"][i],第i個關鍵字是否在字串的中間,"true"代表是,"false"代表不是.
5082
			#$result["center"][i],第i個關鍵字是否在字串的中間,"true"代表是,"false"代表不是.
5083
			#$result["indexS"][i],第i個關鍵字在被搜尋字串的哪個位置開始.
5083
			#$result["indexS"][i],第i個關鍵字在被搜尋字串的哪個位置開始.
5084
			#$result["indexE"][i],第i個關鍵字在被搜尋字串的哪個位置結束.
5084
			#$result["indexE"][i],第i個關鍵字在被搜尋字串的哪個位置結束.
5085
			#必填參數:
5085
			#必填參數:
5086
			
5086
 
5087
			#如果存在 newInputArguForFindKeyWordsPosition,就用之.
5087
			#如果存在 newInputArguForFindKeyWordsPosition,就用之.
5088
			if(isset($newInputArguForFindKeyWordsPosition)){
5088
			if(isset($newInputArguForFindKeyWordsPosition)){
5089
			
5089
 
5090
				#$conf["inputStr"],字串,被搜尋的字串.
5090
				#$conf["inputStr"],字串,被搜尋的字串.
5091
				$conf["search::findKeyWordsPosition"]["inputStr"]=$newInputArguForFindKeyWordsPosition;
5091
				$conf["search::findKeyWordsPosition"]["inputStr"]=$newInputArguForFindKeyWordsPosition;
5092
			
5092
 
5093
				}#if end
5093
				}#if end
5094
			
5094
 
5095
			#反之用原始輸入字串
5095
			#反之用原始輸入字串
5096
			else{
5096
			else{
5097
			
5097
 
5098
				#$conf["inputStr"],字串,被搜尋的字串.
5098
				#$conf["inputStr"],字串,被搜尋的字串.
5099
				$conf["search::findKeyWordsPosition"]["inputStr"]=$conf["input"];
5099
				$conf["search::findKeyWordsPosition"]["inputStr"]=$conf["input"];
5100
			
5100
 
5101
				}#else end
5101
				}#else end
5102
			
5102
 
5103
			#$conf["keyWords"],字串陣列,要搜尋的多個關鍵字
5103
			#$conf["keyWords"],字串陣列,要搜尋的多個關鍵字
5104
			$conf["search::findKeyWordsPosition"]["keyWords"]=$keywords;
5104
			$conf["search::findKeyWordsPosition"]["keyWords"]=$keywords;
5105
			#可省略參數:
5105
			#可省略參數:
5106
			#無.
5106
			#無.
5107
			#參考資料:
5107
			#參考資料:
5108
			#http://php.net/manual/en/function.strpos.php
5108
			#http://php.net/manual/en/function.strpos.php
5109
			#備註:
5109
			#備註:
5110
			#無.
5110
			#無.
5111
			$findKeyWordsPosition=search::findKeyWordsPosition($conf["search::findKeyWordsPosition"]);
5111
			$findKeyWordsPosition=search::findKeyWordsPosition($conf["search::findKeyWordsPosition"]);
5112
			unset($conf["search::findKeyWordsPosition"]);
5112
			unset($conf["search::findKeyWordsPosition"]);
5113
		
5113
 
5114
			#如果執行失敗
5114
			#如果執行失敗
5115
			if($findKeyWordsPosition["status"]==="false"){
5115
			if($findKeyWordsPosition["status"]==="false"){
5116
				
5116
 
5117
				#設置錯誤識別
5117
				#設置錯誤識別
5118
				$result["status"]="false";
5118
				$result["status"]="false";
5119
				
5119
 
5120
				#設置錯誤訊息
5120
				#設置錯誤訊息
5121
				$result["error"]=$findKeyWordsPosition;
5121
				$result["error"]=$findKeyWordsPosition;
5122
				
5122
 
5123
				#回傳結果
5123
				#回傳結果
5124
				return $result;
5124
				return $result;
5125
				
5125
 
5126
				}#if end
5126
				}#if end
5127
			
5127
 
5128
			#如果三個參數 startWith、centerWith、endWith 都在
5128
			#如果三個參數 startWith、centerWith、endWith 都在
5129
			if( isset($conf["startWith"]) && isset($conf["centerWith"]) && isset($conf["endWith"]) ){
5129
			if( isset($conf["startWith"]) && isset($conf["centerWith"]) && isset($conf["endWith"]) ){
5130
			
5130
 
5131
				#如果其中一個關鍵字沒找到
5131
				#如果其中一個關鍵字沒找到
5132
				if( $findKeyWordsPosition["head"][0]!=="true" || $findKeyWordsPosition["center"][1]!=="true" || $findKeyWordsPosition["tail"][2]!=="true" ){
5132
				if( $findKeyWordsPosition["head"][0]!=="true" || $findKeyWordsPosition["center"][1]!=="true" || $findKeyWordsPosition["tail"][2]!=="true" ){
5133
				
5133
 
5134
					#設置執行正常
5134
					#設置執行正常
5135
					$result["status"]="true";
5135
					$result["status"]="true";
5136
					
5136
 
5137
					#設置檢查不通過
5137
					#設置檢查不通過
5138
					$result["passed"]="false";
5138
					$result["passed"]="false";
5139
					
5139
 
5140
					#設置簡易資訊
5140
					#設置簡易資訊
5141
					$result["content"][]="input參數(".$conf["input"].")不完全符合startWith參數(".$conf["startWith"].")、centerWith參數(".$conf["centerWith"].")、endWith參數(".$conf["endWith"].")的條件";
5141
					$result["content"][]="input參數(".$conf["input"].")不完全符合startWith參數(".$conf["startWith"].")、centerWith參數(".$conf["centerWith"].")、endWith參數(".$conf["endWith"].")的條件";
5142
					
5142
 
5143
					#設置詳細資訊
5143
					#設置詳細資訊
5144
					$result["content"][]=$findKeyWordsPosition;
5144
					$result["content"][]=$findKeyWordsPosition;
5145
				
5145
 
5146
					#回傳結果
5146
					#回傳結果
5147
					return $result;
5147
					return $result;
5148
				
5148
 
5149
					}#if end
5149
					}#if end
5150
			
5150
 
5151
				#設置新的input參數
5151
				#設置新的input參數
5152
				$result["newInputArgu"]="";
5152
				$result["newInputArgu"]="";
5153
			
5153
 
5154
				}#if end
5154
				}#if end
5155
			
5155
 
5156
			#反之只有 startWith、centerWith 兩個參數
5156
			#反之只有 startWith、centerWith 兩個參數
5157
			else if( isset($conf["startWith"]) && isset($conf["centerWith"]) ){
5157
			else if( isset($conf["startWith"]) && isset($conf["centerWith"]) ){
5158
			
5158
 
5159
				#如果其中一個關鍵字沒找到
5159
				#如果其中一個關鍵字沒找到
5160
				if( $findKeyWordsPosition["head"][0]!=="true" || $findKeyWordsPosition["center"][1]!=="true" ){
5160
				if( $findKeyWordsPosition["head"][0]!=="true" || $findKeyWordsPosition["center"][1]!=="true" ){
5161
				
5161
 
5162
					#設置執行正常
5162
					#設置執行正常
5163
					$result["status"]="true";
5163
					$result["status"]="true";
5164
					
5164
 
5165
					#設置檢查不通過
5165
					#設置檢查不通過
5166
					$result["passed"]="false";
5166
					$result["passed"]="false";
5167
					
5167
 
5168
					#設置簡易資訊
5168
					#設置簡易資訊
5169
					$result["content"][]="input參數(".$conf["input"].")不完全符合startWith參數(".$conf["startWith"].")、centerWith參數(".$conf["centerWith"].")的條件";
5169
					$result["content"][]="input參數(".$conf["input"].")不完全符合startWith參數(".$conf["startWith"].")、centerWith參數(".$conf["centerWith"].")的條件";
5170
					
5170
 
5171
					#設置詳細資訊
5171
					#設置詳細資訊
5172
					$result["content"][]=$findKeyWordsPosition;
5172
					$result["content"][]=$findKeyWordsPosition;
5173
				
5173
 
5174
					#回傳結果
5174
					#回傳結果
5175
					return $result;
5175
					return $result;
5176
				
5176
 
5177
					}#if end
5177
					}#if end
5178
				
5178
 
5179
				#函式說明:
5179
				#函式說明:
5180
				#unicode的字串分割,比str_split的支援度高.
5180
				#unicode的字串分割,比str_split的支援度高.
5181
				#回傳結果:
5181
				#回傳結果:
5182
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5182
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5183
				#$result["error"],錯誤訊息陣列.	
5183
				#$result["error"],錯誤訊息陣列.
5184
				#$result["function"],當前執行的函數名稱.
5184
				#$result["function"],當前執行的函數名稱.
5185
				#$result["content"],分割好的內容陣列.
5185
				#$result["content"],分割好的內容陣列.
5186
				#$result["length"],unicode字串的長度.
5186
				#$result["length"],unicode字串的長度.
5187
				#必填參數:
5187
				#必填參數:
5188
				#$conf["str"],字串",要分割的字串.
5188
				#$conf["str"],字串",要分割的字串.
Line 5194... Line 5194...
5194
				#http://php.net/manual/en/function.str-split.php
5194
				#http://php.net/manual/en/function.str-split.php
5195
				#備註:
5195
				#備註:
5196
				#無.
5196
				#無.
5197
				$str_split_unicode=stringProcess::str_split_unicode($conf["stringProcess::str_split_unicode"]);
5197
				$str_split_unicode=stringProcess::str_split_unicode($conf["stringProcess::str_split_unicode"]);
5198
				unset($conf["stringProcess::str_split_unicode"]);
5198
				unset($conf["stringProcess::str_split_unicode"]);
5199
					
5199
 
5200
				#如果執行失敗
5200
				#如果執行失敗
5201
				if($str_split_unicode["status"]==="false"){
5201
				if($str_split_unicode["status"]==="false"){
5202
					
5202
 
5203
					#設置執行失敗
5203
					#設置執行失敗
5204
					$result["status"]="false";
5204
					$result["status"]="false";
5205
					
5205
 
5206
					#設置執行錯誤訊息
5206
					#設置執行錯誤訊息
5207
					$result["error"]=$str_split_unicode;
5207
					$result["error"]=$str_split_unicode;
5208
					
5208
 
5209
					#回傳結果
5209
					#回傳結果
5210
					return $result;
5210
					return $result;
5211
					
5211
 
5212
					}#if end	
5212
					}#if end
5213
				
5213
 
5214
				#針對剩下的每個bytes
5214
				#針對剩下的每個bytes
5215
				foreach($str_split_unicode["content"] as $splitedStr){
5215
				foreach($str_split_unicode["content"] as $splitedStr){
5216
				
5216
 
5217
					#串接新的input參數bytes
5217
					#串接新的input參數bytes
5218
					$result["newInputArgu"]=$result["newInputArgu"].$splitedStr;
5218
					$result["newInputArgu"]=$result["newInputArgu"].$splitedStr;
5219
				
5219
 
5220
					}#foreach end
5220
					}#foreach end
5221
				
5221
 
5222
				}#if end
5222
				}#if end
5223
				
5223
 
5224
			#反之只有 startWith、endWith 兩個參數
5224
			#反之只有 startWith、endWith 兩個參數
5225
			else if( isset($conf["startWith"]) && isset($conf["endWith"]) ){
5225
			else if( isset($conf["startWith"]) && isset($conf["endWith"]) ){
5226
			
5226
 
5227
				#如果其中一個關鍵字沒找到
5227
				#如果其中一個關鍵字沒找到
5228
				if( $findKeyWordsPosition["head"][0]!=="true" || $findKeyWordsPosition["tail"][1]!=="true" ){
5228
				if( $findKeyWordsPosition["head"][0]!=="true" || $findKeyWordsPosition["tail"][1]!=="true" ){
5229
				
5229
 
5230
					#設置執行正常
5230
					#設置執行正常
5231
					$result["status"]="true";
5231
					$result["status"]="true";
5232
					
5232
 
5233
					#設置檢查不通過
5233
					#設置檢查不通過
5234
					$result["passed"]="false";
5234
					$result["passed"]="false";
5235
					
5235
 
5236
					#設置簡易資訊
5236
					#設置簡易資訊
5237
					$result["content"][]="input參數(".$conf["input"].")不完全符合startWith參數(".$conf["startWith"].")、endWith參數(".$conf["endWith"].")的條件";
5237
					$result["content"][]="input參數(".$conf["input"].")不完全符合startWith參數(".$conf["startWith"].")、endWith參數(".$conf["endWith"].")的條件";
5238
					
5238
 
5239
					#設置詳細資訊
5239
					#設置詳細資訊
5240
					$result["content"][]=$findKeyWordsPosition;
5240
					$result["content"][]=$findKeyWordsPosition;
5241
				
5241
 
5242
					#回傳結果
5242
					#回傳結果
5243
					return $result;
5243
					return $result;
5244
				
5244
 
5245
					}#if end
5245
					}#if end
5246
					
5246
 
5247
				#設置新的input參數
5247
				#設置新的input參數
5248
				$result["newInputArgu"]="";
5248
				$result["newInputArgu"]="";
5249
			
5249
 
5250
				}#if end
5250
				}#if end
5251
		
5251
 
5252
			#反之只有 centerWith、endWith 兩個參數
5252
			#反之只有 centerWith、endWith 兩個參數
5253
			else if( isset($conf["centerWith"]) && isset($conf["endWith"]) ){
5253
			else if( isset($conf["centerWith"]) && isset($conf["endWith"]) ){
5254
 
5254
 
5255
				#如果其中一個關鍵字沒找到
5255
				#如果其中一個關鍵字沒找到
5256
				if( $findKeyWordsPosition["center"][0]!=="true" || $findKeyWordsPosition["tail"][1]!=="true" ){
5256
				if( $findKeyWordsPosition["center"][0]!=="true" || $findKeyWordsPosition["tail"][1]!=="true" ){
5257
				
5257
 
5258
					#設置執行正常
5258
					#設置執行正常
5259
					$result["status"]="true";
5259
					$result["status"]="true";
5260
					
5260
 
5261
					#設置檢查不通過
5261
					#設置檢查不通過
5262
					$result["passed"]="false";
5262
					$result["passed"]="false";
5263
					
5263
 
5264
					#設置簡易資訊
5264
					#設置簡易資訊
5265
					$result["content"][]="input參數(".$conf["input"].")不完全符合centerWith參數(".$conf["centerWith"].")、endWith參數(".$conf["endWith"].")的條件";
5265
					$result["content"][]="input參數(".$conf["input"].")不完全符合centerWith參數(".$conf["centerWith"].")、endWith參數(".$conf["endWith"].")的條件";
5266
					
5266
 
5267
					#設置詳細資訊
5267
					#設置詳細資訊
5268
					$result["content"][]=$findKeyWordsPosition;
5268
					$result["content"][]=$findKeyWordsPosition;
5269
				
5269
 
5270
					#回傳結果
5270
					#回傳結果
5271
					return $result;
5271
					return $result;
5272
				
5272
 
5273
					}#if end
5273
					}#if end
5274
					
5274
 
5275
				#設置新的input參數
5275
				#設置新的input參數
5276
				$result["newInputArgu"]="";
5276
				$result["newInputArgu"]="";
5277
 
5277
 
5278
				}#if end
5278
				}#if end
5279
				
5279
 
5280
			#反之只有 startWith 參數
5280
			#反之只有 startWith 參數
5281
			else if(isset($conf["startWith"])){
5281
			else if(isset($conf["startWith"])){
5282
			
5282
 
5283
				#如果其中一個關鍵字沒找到
5283
				#如果其中一個關鍵字沒找到
5284
				if( $findKeyWordsPosition["head"][0]!=="true" ){
5284
				if( $findKeyWordsPosition["head"][0]!=="true" ){
5285
				
5285
 
5286
					#設置執行正常
5286
					#設置執行正常
5287
					$result["status"]="true";
5287
					$result["status"]="true";
5288
					
5288
 
5289
					#設置檢查不通過
5289
					#設置檢查不通過
5290
					$result["passed"]="false";
5290
					$result["passed"]="false";
5291
					
5291
 
5292
					#設置簡易資訊
5292
					#設置簡易資訊
5293
					$result["content"][]="input參數(".$conf["input"].")不符合startWith參數(".$conf["startWith"].")的條件";
5293
					$result["content"][]="input參數(".$conf["input"].")不符合startWith參數(".$conf["startWith"].")的條件";
5294
					
5294
 
5295
					#設置詳細資訊
5295
					#設置詳細資訊
5296
					$result["content"][]=$findKeyWordsPosition;
5296
					$result["content"][]=$findKeyWordsPosition;
5297
				
5297
 
5298
					#回傳結果
5298
					#回傳結果
5299
					return $result;
5299
					return $result;
5300
				
5300
 
5301
					}#if end
5301
					}#if end
5302
					
5302
 
5303
				#函式說明:
5303
				#函式說明:
5304
				#unicode的字串分割,比str_split的支援度高.
5304
				#unicode的字串分割,比str_split的支援度高.
5305
				#回傳結果:
5305
				#回傳結果:
5306
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5306
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5307
				#$result["error"],錯誤訊息陣列.	
5307
				#$result["error"],錯誤訊息陣列.
5308
				#$result["function"],當前執行的函數名稱.
5308
				#$result["function"],當前執行的函數名稱.
5309
				#$result["content"],分割好的內容陣列.
5309
				#$result["content"],分割好的內容陣列.
5310
				#$result["length"],unicode字串的長度.
5310
				#$result["length"],unicode字串的長度.
5311
				#必填參數:
5311
				#必填參數:
5312
				#$conf["str"],字串",要分割的字串.
5312
				#$conf["str"],字串",要分割的字串.
Line 5318... Line 5318...
5318
				#http://php.net/manual/en/function.str-split.php
5318
				#http://php.net/manual/en/function.str-split.php
5319
				#備註:
5319
				#備註:
5320
				#無.
5320
				#無.
5321
				$str_split_unicode=stringProcess::str_split_unicode($conf["stringProcess::str_split_unicode"]);
5321
				$str_split_unicode=stringProcess::str_split_unicode($conf["stringProcess::str_split_unicode"]);
5322
				unset($conf["stringProcess::str_split_unicode"]);
5322
				unset($conf["stringProcess::str_split_unicode"]);
5323
					
5323
 
5324
				#如果執行失敗
5324
				#如果執行失敗
5325
				if($str_split_unicode["status"]==="false"){
5325
				if($str_split_unicode["status"]==="false"){
5326
					
5326
 
5327
					#設置執行失敗
5327
					#設置執行失敗
5328
					$result["status"]="false";
5328
					$result["status"]="false";
5329
					
5329
 
5330
					#設置執行錯誤訊息
5330
					#設置執行錯誤訊息
5331
					$result["error"]=$str_split_unicode;
5331
					$result["error"]=$str_split_unicode;
5332
					
5332
 
5333
					#回傳結果
5333
					#回傳結果
5334
					return $result;
5334
					return $result;
5335
					
5335
 
5336
					}#if end	
5336
					}#if end
5337
				
5337
 
5338
				#針對剩下的每個bytes
5338
				#針對剩下的每個bytes
5339
				foreach($str_split_unicode["content"] as $splitedStr){
5339
				foreach($str_split_unicode["content"] as $splitedStr){
5340
				
5340
 
5341
					#串接新的input參數bytes
5341
					#串接新的input參數bytes
5342
					$result["newInputArgu"]=$result["newInputArgu"].$splitedStr;
5342
					$result["newInputArgu"]=$result["newInputArgu"].$splitedStr;
5343
				
5343
 
5344
					}#foreach end
5344
					}#foreach end
5345
			
5345
 
5346
				}#if end
5346
				}#if end
5347
				
5347
 
5348
			#反之只有 centerWith 參數
5348
			#反之只有 centerWith 參數
5349
			else if(isset($conf["centerWith"])){
5349
			else if(isset($conf["centerWith"])){
5350
			
5350
 
5351
				#如果其中一個關鍵字沒找到
5351
				#如果其中一個關鍵字沒找到
5352
				if( $findKeyWordsPosition["center"][0]!=="true" ){
5352
				if( $findKeyWordsPosition["center"][0]!=="true" ){
5353
				
5353
 
5354
					#設置執行正常
5354
					#設置執行正常
5355
					$result["status"]="true";
5355
					$result["status"]="true";
5356
					
5356
 
5357
					#設置檢查不通過
5357
					#設置檢查不通過
5358
					$result["passed"]="false";
5358
					$result["passed"]="false";
5359
					
5359
 
5360
					#設置簡易資訊
5360
					#設置簡易資訊
5361
					$result["content"][]="input參數(".$conf["input"].")不符合centertWith參數(".$conf["centertWith"].")的條件";
5361
					$result["content"][]="input參數(".$conf["input"].")不符合centertWith參數(".$conf["centertWith"].")的條件";
5362
					
5362
 
5363
					#設置詳細資訊
5363
					#設置詳細資訊
5364
					$result["content"][]=$findKeyWordsPosition;
5364
					$result["content"][]=$findKeyWordsPosition;
5365
				
5365
 
5366
					#回傳結果
5366
					#回傳結果
5367
					return $result;
5367
					return $result;
5368
				
5368
 
5369
					}#if end
5369
					}#if end
5370
					
5370
 
5371
				#函式說明:
5371
				#函式說明:
5372
				#unicode的字串分割,比str_split的支援度高.
5372
				#unicode的字串分割,比str_split的支援度高.
5373
				#回傳結果:
5373
				#回傳結果:
5374
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5374
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5375
				#$result["error"],錯誤訊息陣列.	
5375
				#$result["error"],錯誤訊息陣列.
5376
				#$result["function"],當前執行的函數名稱.
5376
				#$result["function"],當前執行的函數名稱.
5377
				#$result["content"],分割好的內容陣列.
5377
				#$result["content"],分割好的內容陣列.
5378
				#$result["length"],unicode字串的長度.
5378
				#$result["length"],unicode字串的長度.
5379
				#必填參數:
5379
				#必填參數:
5380
				#$conf["str"],字串",要分割的字串.
5380
				#$conf["str"],字串",要分割的字串.
Line 5386... Line 5386...
5386
				#http://php.net/manual/en/function.str-split.php
5386
				#http://php.net/manual/en/function.str-split.php
5387
				#備註:
5387
				#備註:
5388
				#無.
5388
				#無.
5389
				$str_split_unicode=stringProcess::str_split_unicode($conf["stringProcess::str_split_unicode"]);
5389
				$str_split_unicode=stringProcess::str_split_unicode($conf["stringProcess::str_split_unicode"]);
5390
				unset($conf["stringProcess::str_split_unicode"]);
5390
				unset($conf["stringProcess::str_split_unicode"]);
5391
					
5391
 
5392
				#如果執行失敗
5392
				#如果執行失敗
5393
				if($str_split_unicode["status"]==="false"){
5393
				if($str_split_unicode["status"]==="false"){
5394
					
5394
 
5395
					#設置執行失敗
5395
					#設置執行失敗
5396
					$result["status"]="false";
5396
					$result["status"]="false";
5397
					
5397
 
5398
					#設置執行錯誤訊息
5398
					#設置執行錯誤訊息
5399
					$result["error"]=$str_split_unicode;
5399
					$result["error"]=$str_split_unicode;
5400
					
5400
 
5401
					#回傳結果
5401
					#回傳結果
5402
					return $result;
5402
					return $result;
5403
					
5403
 
5404
					}#if end	
5404
					}#if end
5405
				
5405
 
5406
				#針對剩下的每個bytes
5406
				#針對剩下的每個bytes
5407
				foreach($str_split_unicode["content"] as $splitedStr){
5407
				foreach($str_split_unicode["content"] as $splitedStr){
5408
				
5408
 
5409
					#串接新的input參數bytes
5409
					#串接新的input參數bytes
5410
					$result["newInputArgu"]=$result["newInputArgu"].$splitedStr;
5410
					$result["newInputArgu"]=$result["newInputArgu"].$splitedStr;
5411
				
5411
 
5412
					}#foreach end
5412
					}#foreach end
5413
			
5413
 
5414
				}#if end
5414
				}#if end
5415
				
5415
 
5416
			#反之只有 endWith 參數
5416
			#反之只有 endWith 參數
5417
			else if(isset($conf["endWith"])){
5417
			else if(isset($conf["endWith"])){
5418
			
5418
 
5419
				#如果其中一個關鍵字沒找到
5419
				#如果其中一個關鍵字沒找到
5420
				if( $findKeyWordsPosition["tail"][0]!=="true" ){
5420
				if( $findKeyWordsPosition["tail"][0]!=="true" ){
5421
				
5421
 
5422
					#設置執行正常
5422
					#設置執行正常
5423
					$result["status"]="true";
5423
					$result["status"]="true";
5424
					
5424
 
5425
					#設置檢查不通過
5425
					#設置檢查不通過
5426
					$result["passed"]="false";
5426
					$result["passed"]="false";
5427
					
5427
 
5428
					#設置簡易資訊
5428
					#設置簡易資訊
5429
					$result["content"][]="input參數(".$conf["input"].")不符合endWith參數(".$conf["endWith"].")的條件";
5429
					$result["content"][]="input參數(".$conf["input"].")不符合endWith參數(".$conf["endWith"].")的條件";
5430
					
5430
 
5431
					#設置詳細資訊
5431
					#設置詳細資訊
5432
					$result["content"][]=$findKeyWordsPosition;
5432
					$result["content"][]=$findKeyWordsPosition;
5433
				
5433
 
5434
					#回傳結果
5434
					#回傳結果
5435
					return $result;
5435
					return $result;
5436
				
5436
 
5437
					}#if end
5437
					}#if end
5438
					
5438
 
5439
				#設置新的input參數
5439
				#設置新的input參數
5440
				$result["newInputArgu"]="";
5440
				$result["newInputArgu"]="";
5441
			
5441
 
5442
				}#if end
5442
				}#if end
5443
				
5443
 
5444
			#反之不可能發生的地方
5444
			#反之不可能發生的地方
5445
			else{
5445
			else{
5446
			
5446
 
5447
				#設置錯誤識別
5447
				#設置錯誤識別
5448
				$result["status"]="false";
5448
				$result["status"]="false";
5449
				
5449
 
5450
				#設置錯誤訊息
5450
				#設置錯誤訊息
5451
				$result["error"][]="非預期的錯誤";
5451
				$result["error"][]="非預期的錯誤";
5452
				
5452
 
5453
				#設置錯誤訊息
5453
				#設置錯誤訊息
5454
				$result["error"][]=$findKeyWordsPosition;
5454
				$result["error"][]=$findKeyWordsPosition;
5455
				
5455
 
5456
				#回傳結果
5456
				#回傳結果
5457
				return $result;
5457
				return $result;
5458
			
5458
 
5459
				}#else end
5459
				}#else end
5460
				
5460
 
5461
			#如果存在
5461
			#如果存在
5462
			if(isset($newInputArgu)){
5462
			if(isset($newInputArgu)){
5463
			
5463
 
5464
				#更新之
5464
				#更新之
5465
				$result["newInputArgu"]=$newInputArgu;
5465
				$result["newInputArgu"]=$newInputArgu;
5466
			
5466
 
5467
				}#if end
5467
				}#if end
5468
		
5468
 
5469
			}#if end
5469
			}#if end
5470
		
5470
 
5471
		#反之,沒有關鍵字
5471
		#反之,沒有關鍵字
5472
		else{
5472
		else{
5473
		
5473
 
5474
			#若有指定bytes長度
5474
			#若有指定bytes長度
5475
			if(isset($conf["length"])){
5475
			if(isset($conf["length"])){
5476
			
5476
 
5477
				#取得輸入的字位長度
5477
				#取得輸入的字位長度
5478
				$length=length($conf["input"]);
5478
				$length=length($conf["input"]);
5479
			
5479
 
5480
				#如果不相等
5480
				#如果不相等
5481
				if($length!==(int)$conf["length"]){
5481
				if($length!==(int)$conf["length"]){
5482
				
5482
 
5483
					#設置執行正常
5483
					#設置執行正常
5484
					$result["status"]="true";
5484
					$result["status"]="true";
5485
					
5485
 
5486
					#設置檢查不通過
5486
					#設置檢查不通過
5487
					$result["passed"]="false";
5487
					$result["passed"]="false";
5488
					
5488
 
5489
					#設置詳細結果訊息陣列.
5489
					#設置詳細結果訊息陣列.
5490
					$result["content"][]="input參數(".$conf["input"].")的bytes長度(".$length.")與length參數(".$conf["length"].")不相等";
5490
					$result["content"][]="input參數(".$conf["input"].")的bytes長度(".$length.")與length參數(".$conf["length"].")不相等";
5491
				
5491
 
5492
					#回傳結果
5492
					#回傳結果
5493
					return $result;
5493
					return $result;
5494
				
5494
 
5495
					}#if end
5495
					}#if end
5496
					
5496
 
5497
				#函式說明:
5497
				#函式說明:
5498
				#unicode的字串分割,比str_split的支援度高.
5498
				#unicode的字串分割,比str_split的支援度高.
5499
				#回傳結果:
5499
				#回傳結果:
5500
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5500
				#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5501
				#$result["error"],錯誤訊息陣列.	
5501
				#$result["error"],錯誤訊息陣列.
5502
				#$result["function"],當前執行的函數名稱.
5502
				#$result["function"],當前執行的函數名稱.
5503
				#$result["content"],分割好的內容陣列.
5503
				#$result["content"],分割好的內容陣列.
5504
				#$result["length"],unicode字串的長度.
5504
				#$result["length"],unicode字串的長度.
5505
				#必填參數:
5505
				#必填參數:
5506
				#$conf["str"],字串",要分割的字串.
5506
				#$conf["str"],字串",要分割的字串.
Line 5512... Line 5512...
5512
				#http://php.net/manual/en/function.str-split.php
5512
				#http://php.net/manual/en/function.str-split.php
5513
				#備註:
5513
				#備註:
5514
				#無.
5514
				#無.
5515
				$str_split_unicode=stringProcess::str_split_unicode($conf["stringProcess::str_split_unicode"]);
5515
				$str_split_unicode=stringProcess::str_split_unicode($conf["stringProcess::str_split_unicode"]);
5516
				unset($conf["stringProcess::str_split_unicode"]);
5516
				unset($conf["stringProcess::str_split_unicode"]);
5517
					
5517
 
5518
				#如果執行失敗
5518
				#如果執行失敗
5519
				if($str_split_unicode["status"]==="false"){
5519
				if($str_split_unicode["status"]==="false"){
5520
					
5520
 
5521
					#設置執行失敗
5521
					#設置執行失敗
5522
					$result["status"]="false";
5522
					$result["status"]="false";
5523
					
5523
 
5524
					#設置執行錯誤訊息
5524
					#設置執行錯誤訊息
5525
					$result["error"]=$str_split_unicode;
5525
					$result["error"]=$str_split_unicode;
5526
					
5526
 
5527
					#回傳結果
5527
					#回傳結果
5528
					return $result;
5528
					return $result;
5529
					
5529
 
5530
					}#if end	
5530
					}#if end
5531
				
5531
 
5532
				#針對剩下的每個bytes
5532
				#針對剩下的每個bytes
5533
				foreach($str_split_unicode["content"] as $splitedStr){
5533
				foreach($str_split_unicode["content"] as $splitedStr){
5534
				
5534
 
5535
					#串接新的input參數bytes
5535
					#串接新的input參數bytes
5536
					$result["newInputArgu"]=$result["newInputArgu"].$splitedStr;
5536
					$result["newInputArgu"]=$result["newInputArgu"].$splitedStr;
5537
				
5537
 
5538
					}#foreach end
5538
					}#foreach end
5539
			
5539
 
5540
				}#if end
5540
				}#if end
5541
			
5541
 
5542
			#反之不存在指定bytes長度
5542
			#反之不存在指定bytes長度
5543
			
5543
 
5544
			#但有指定字位長度
5544
			#但有指定字位長度
5545
			else if(isset($conf["lengthGrapheme"])){
5545
			else if(isset($conf["lengthGrapheme"])){
5546
			
5546
 
5547
				#取得輸入的字位長度
5547
				#取得輸入的字位長度
5548
				$grapheme_strlen=grapheme_strlen($conf["input"]);
5548
				$grapheme_strlen=grapheme_strlen($conf["input"]);
5549
			
5549
 
5550
				#如果不相等
5550
				#如果不相等
5551
				if($grapheme_strlen!==(int)$conf["lengthGrapheme"]){
5551
				if($grapheme_strlen!==(int)$conf["lengthGrapheme"]){
5552
				
5552
 
5553
					#設置執行正常
5553
					#設置執行正常
5554
					$result["status"]="true";
5554
					$result["status"]="true";
5555
					
5555
 
5556
					#設置檢查不通過
5556
					#設置檢查不通過
5557
					$result["passed"]="false";
5557
					$result["passed"]="false";
5558
					
5558
 
5559
					#設置詳細結果訊息陣列.
5559
					#設置詳細結果訊息陣列.
5560
					$result["content"][]="input參數(".$conf["input"].")的字位長度(".$grapheme_strlen.")與lengthGrapheme參數(".$conf["lengthGrapheme"].")不相等";
5560
					$result["content"][]="input參數(".$conf["input"].")的字位長度(".$grapheme_strlen.")與lengthGrapheme參數(".$conf["lengthGrapheme"].")不相等";
5561
				
5561
 
5562
					#回傳結果
5562
					#回傳結果
5563
					return $result;
5563
					return $result;
5564
				
5564
 
5565
					}#if end
5565
					}#if end
5566
				
5566
 
5567
				#取得新的input參數
5567
				#取得新的input參數
5568
				$result["newInputArgu"]=grapheme_substr($conf["input"],0,$conf["lengthGrapheme"]);
5568
				$result["newInputArgu"]=grapheme_substr($conf["input"],0,$conf["lengthGrapheme"]);
5569
			
5569
 
5570
				}#if end
5570
				}#if end
5571
			
5571
 
5572
			#反之不存在指定字位長度
5572
			#反之不存在指定字位長度
5573
		
5573
 
5574
			#但有指定 equalWith
5574
			#但有指定 equalWith
5575
			else if(isset($conf["equalWith"])){
5575
			else if(isset($conf["equalWith"])){
5576
			
5576
 
5577
				#如果不相等
5577
				#如果不相等
5578
				if($conf["input"]!==$conf["equalWith"]){
5578
				if($conf["input"]!==$conf["equalWith"]){
5579
				
5579
 
5580
					#設置執行正常
5580
					#設置執行正常
5581
					$result["status"]="true";
5581
					$result["status"]="true";
5582
					
5582
 
5583
					#設置檢查不通過
5583
					#設置檢查不通過
5584
					$result["passed"]="false";
5584
					$result["passed"]="false";
5585
					
5585
 
5586
					#設置詳細結果訊息陣列.
5586
					#設置詳細結果訊息陣列.
5587
					$result["content"][]="input參數(".$conf["input"].")與equalWith參數(".$conf["equalWith"].")不相等";
5587
					$result["content"][]="input參數(".$conf["input"].")與equalWith參數(".$conf["equalWith"].")不相等";
5588
				
5588
 
5589
					#回傳結果
5589
					#回傳結果
5590
					return $result;
5590
					return $result;
5591
				
5591
 
5592
					}#if end
5592
					}#if end
5593
				
5593
 
5594
				}#if end
5594
				}#if end
5595
				
5595
 
5596
			}#else(沒有關鍵字) end
5596
			}#else(沒有關鍵字) end
5597
			
5597
 
5598
		#設置執行正常
5598
		#設置執行正常
5599
		$result["status"]="true";
5599
		$result["status"]="true";
5600
		
5600
 
5601
		#設置檢查通過
5601
		#設置檢查通過
5602
		$result["passed"]="true";
5602
		$result["passed"]="true";
5603
		
5603
 
5604
		#回傳結果
5604
		#回傳結果
5605
		return $result;
5605
		return $result;
5606
	
5606
 
5607
		}#checkStringFormat end
5607
		}#checkStringFormat end
5608
 
5608
 
5609
	/*
5609
	/*
5610
	#函式說明:
5610
	#函式說明:
5611
	#檢查字串是否符合 RFC 3339/ISO-8601 格式
5611
	#檢查字串是否符合 RFC 3339/ISO-8601 格式
Line 5626... Line 5626...
5626
	#rfc3339=>https://www.rfc-editor.org/rfc/rfc3339
5626
	#rfc3339=>https://www.rfc-editor.org/rfc/rfc3339
5627
	#備註:
5627
	#備註:
5628
	#無.
5628
	#無.
5629
	*/
5629
	*/
5630
	public static function checkRFC3339(&$conf){
5630
	public static function checkRFC3339(&$conf){
5631
	
5631
 
5632
		#初始化要回傳的結果
5632
		#初始化要回傳的結果
5633
		$result=array();
5633
		$result=array();
5634
		
5634
 
5635
		#設置當其函數名稱
5635
		#設置當其函數名稱
5636
		$result["function"]=__FUNCTION__;
5636
		$result["function"]=__FUNCTION__;
5637
		
5637
 
5638
		#如果 $conf 不為陣列
5638
		#如果 $conf 不為陣列
5639
		if(gettype($conf)!="array"){
5639
		if(gettype($conf)!="array"){
5640
			
5640
 
5641
			#設置執行失敗
5641
			#設置執行失敗
5642
			$result["status"]="false";
5642
			$result["status"]="false";
5643
			
5643
 
5644
			#設置執行錯誤訊息
5644
			#設置執行錯誤訊息
5645
			$result["error"][]="\$conf變數須為陣列形態";
5645
			$result["error"][]="\$conf變數須為陣列形態";
5646
 
5646
 
5647
			#如果傳入的參數為 null
5647
			#如果傳入的參數為 null
5648
			if($conf==null){
5648
			if($conf==null){
5649
				
5649
 
5650
				#設置執行錯誤訊息
5650
				#設置執行錯誤訊息
5651
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
5651
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
5652
				
5652
 
5653
				}#if end
5653
				}#if end
5654
 
5654
 
5655
			#回傳結果
5655
			#回傳結果
5656
			return $result;
5656
			return $result;
5657
			
5657
 
5658
			}#if end
5658
			}#if end
5659
		
5659
 
5660
		#取得使用的參數
5660
		#取得使用的參數
5661
		$result["argu"]=$conf;
5661
		$result["argu"]=$conf;
5662
		
5662
 
5663
		#檢查參數
5663
		#檢查參數
5664
		#函式說明:
5664
		#函式說明:
5665
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
5665
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
5666
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5666
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5667
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
5667
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 5676... Line 5676...
5676
		#必填寫的參數:
5676
		#必填寫的參數:
5677
		#$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
5677
		#$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
5678
		$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
5678
		$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
5679
		#$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
5679
		#$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
5680
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("input");
5680
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("input");
5681
		#$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double"); 
5681
		#$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double");
5682
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string");
5682
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string");
5683
		#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
5683
		#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
5684
		$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
5684
		$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
5685
		#可以省略的參數:
5685
		#可以省略的參數:
5686
		#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或集合.
5686
		#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或集合.
5687
		$conf["variableCheck::checkArguments"]["skipableVariableCanNotBeEmpty"]=array("UTC");
5687
		$conf["variableCheck::checkArguments"]["skipableVariableCanNotBeEmpty"]=array("UTC");
5688
		#$conf["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
5688
		#$conf["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
5689
		$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
5689
		$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
5690
		#$conf["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
5690
		#$conf["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
5691
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("UTC");
5691
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("UTC");
5692
		#$conf["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double"); 
5692
		#$conf["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
5693
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string");
5693
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string");
5694
		#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
5694
		#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
5695
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("true");
5695
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("true");
5696
		#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
5696
		#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
5697
		#$conf["arrayCountEqualCheck"][]=array();
5697
		#$conf["arrayCountEqualCheck"][]=array();
5698
		#參考資料來源:
5698
		#參考資料來源:
5699
		#array_keys=>http://php.net/manual/en/function.array-keys.php
5699
		#array_keys=>http://php.net/manual/en/function.array-keys.php
5700
		$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
5700
		$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
5701
		unset($conf["variableCheck::checkArguments"]);
5701
		unset($conf["variableCheck::checkArguments"]);
5702
		
5702
 
5703
		#如果檢查失敗
5703
		#如果檢查失敗
5704
		if($checkResult["status"]==="false"){
5704
		if($checkResult["status"]==="false"){
5705
			
5705
 
5706
			#設置執行失敗的訊息
5706
			#設置執行失敗的訊息
5707
			$result["status"]="false";
5707
			$result["status"]="false";
5708
			
5708
 
5709
			#設置錯誤訊息
5709
			#設置錯誤訊息
5710
			$result["error"]=$checkResult;
5710
			$result["error"]=$checkResult;
5711
			
5711
 
5712
			#回傳結果
5712
			#回傳結果
5713
			return $result;
5713
			return $result;
5714
			
5714
 
5715
			}#if end
5715
			}#if end
5716
		
5716
 
5717
		#如果檢查不通過
5717
		#如果檢查不通過
5718
		if($checkResult["passed"]==="false"){
5718
		if($checkResult["passed"]==="false"){
5719
			
5719
 
5720
			#設置執行失敗的訊息
5720
			#設置執行失敗的訊息
5721
			$result["status"]="false";
5721
			$result["status"]="false";
5722
			
5722
 
5723
			#設置錯誤訊息
5723
			#設置錯誤訊息
5724
			$result["error"]=$checkResult;
5724
			$result["error"]=$checkResult;
5725
			
5725
 
5726
			#回傳結果
5726
			#回傳結果
5727
			return $result;
5727
			return $result;
5728
			
5728
 
5729
			}#if end
5729
			}#if end
5730
		
5730
 
5731
		#函式說明:
5731
		#函式說明:
5732
		#計算時間點距離1970/01/01多少秒,亦即unixtime.
5732
		#計算時間點距離1970/01/01多少秒,亦即unixtime.
5733
		#回傳結果:
5733
		#回傳結果:
5734
		#$result["stauts"],執行是否成功,"true"代表執行成功;"false"代表執行失敗.
5734
		#$result["stauts"],執行是否成功,"true"代表執行成功;"false"代表執行失敗.
5735
		#$result["error"],錯誤訊息陣列.
5735
		#$result["error"],錯誤訊息陣列.
Line 5747... Line 5747...
5747
		#無.
5747
		#無.
5748
		#備註:
5748
		#備註:
5749
		#無.
5749
		#無.
5750
		$caculateTimeAmount=time::caculateTimeAmount($conf["time::caculateTimeAmount"]);
5750
		$caculateTimeAmount=time::caculateTimeAmount($conf["time::caculateTimeAmount"]);
5751
		unset($conf["time::caculateTimeAmount"]);
5751
		unset($conf["time::caculateTimeAmount"]);
5752
		
5752
 
5753
		#如果檢查失敗
5753
		#如果檢查失敗
5754
		if($caculateTimeAmount["status"]==="false"){
5754
		if($caculateTimeAmount["status"]==="false"){
5755
			
5755
 
5756
			#設置執行正常的識別
5756
			#設置執行正常的識別
5757
			$result["status"]="true";
5757
			$result["status"]="true";
5758
			
5758
 
5759
			#設置檢查不通過
5759
			#設置檢查不通過
5760
			$result["passed"]="false";
5760
			$result["passed"]="false";
5761
			
5761
 
5762
			#設置回饋的訊息
5762
			#設置回饋的訊息
5763
			$result["content"]=$caculateTimeAmount;
5763
			$result["content"]=$caculateTimeAmount;
5764
			
5764
 
5765
			#回傳結果
5765
			#回傳結果
5766
			return $result;
5766
			return $result;
5767
			
5767
 
5768
			}#if end
5768
			}#if end
5769
			
5769
 
5770
		#設置執行正常的識別
5770
		#設置執行正常的識別
5771
		$result["status"]="true";
5771
		$result["status"]="true";
5772
		
5772
 
5773
		#設置檢查通過
5773
		#設置檢查通過
5774
		$result["passed"]="true";
5774
		$result["passed"]="true";
5775
		
5775
 
5776
		#回傳結果
5776
		#回傳結果
5777
		return $result;
5777
		return $result;
5778
		
5778
 
5779
		}#function checkRFC3339 end
5779
		}#function checkRFC3339 end
5780
 
5780
 
5781
	/*
5781
	/*
5782
	#函式說明:
5782
	#函式說明:
5783
	#處理各種錯誤與例外.
5783
	#處理各種錯誤與例外.
Line 5799... Line 5799...
5799
	#無.
5799
	#無.
5800
	#備註:
5800
	#備註:
5801
	#由於是使用 set_exception_handler 因此程式會結束執行.
5801
	#由於是使用 set_exception_handler 因此程式會結束執行.
5802
	*/
5802
	*/
5803
	public static function setErrorHandler(&$conf=array()){
5803
	public static function setErrorHandler(&$conf=array()){
5804
	
5804
 
5805
		#初始化要回傳的結果
5805
		#初始化要回傳的結果
5806
		$result=array();
5806
		$result=array();
5807
 
5807
 
5808
		#取得當前執行的函數名稱
5808
		#取得當前執行的函數名稱
5809
		$result["function"]=__FUNCTION__;
5809
		$result["function"]=__FUNCTION__;
5810
		
5810
 
5811
		#取得參數
5811
		#取得參數
5812
		$result["argu"]=$conf;
5812
		$result["argu"]=$conf;
5813
 
5813
 
5814
		#如果 $conf 不為陣列
5814
		#如果 $conf 不為陣列
5815
		if(gettype($conf)!="array"){
5815
		if(gettype($conf)!="array"){
Line 5830... Line 5830...
5830
 
5830
 
5831
			#回傳結果
5831
			#回傳結果
5832
			return $result;
5832
			return $result;
5833
 
5833
 
5834
			}#if end
5834
			}#if end
5835
		
5835
 
5836
		#檢查參數
5836
		#檢查參數
5837
		#函式說明:
5837
		#函式說明:
5838
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
5838
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
5839
		#回傳結果:
5839
		#回傳結果:
5840
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5840
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 5886... Line 5886...
5886
		#array_keys=>http://php.net/manual/en/function.array-keys.php
5886
		#array_keys=>http://php.net/manual/en/function.array-keys.php
5887
		#備註:
5887
		#備註:
5888
		#無.
5888
		#無.
5889
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
5889
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
5890
		unset($conf["variableCheck::checkArguments"]);
5890
		unset($conf["variableCheck::checkArguments"]);
5891
		
5891
 
5892
		#如果執行失敗
5892
		#如果執行失敗
5893
		if($checkArguments["status"]==="false"){
5893
		if($checkArguments["status"]==="false"){
5894
		
5894
 
5895
			#設置執行失敗
5895
			#設置執行失敗
5896
			$result["status"]="false";
5896
			$result["status"]="false";
5897
			
5897
 
5898
			#設置錯誤資訊
5898
			#設置錯誤資訊
5899
			$result["error"]=$checkArguments;
5899
			$result["error"]=$checkArguments;
5900
		
5900
 
5901
			#回傳結果
5901
			#回傳結果
5902
			return $result;
5902
			return $result;
5903
		
5903
 
5904
			}#if end
5904
			}#if end
5905
			
5905
 
5906
		#如果檢查不通過
5906
		#如果檢查不通過
5907
		if($checkArguments["passed"]==="false"){
5907
		if($checkArguments["passed"]==="false"){
5908
		
5908
 
5909
			#設置執行失敗
5909
			#設置執行失敗
5910
			$result["status"]="false";
5910
			$result["status"]="false";
5911
			
5911
 
5912
			#設置錯誤資訊
5912
			#設置錯誤資訊
5913
			$result["error"]=$checkArguments;
5913
			$result["error"]=$checkArguments;
5914
		
5914
 
5915
			#回傳結果
5915
			#回傳結果
5916
			return $result;
5916
			return $result;
5917
		
5917
 
5918
			}#if end
5918
			}#if end
5919
	
5919
 
5920
		#設置給本函式使用的 conf
5920
		#設置給本函式使用的 conf
5921
		self::$setErrorHandlerConf=$conf;
5921
		self::$setErrorHandlerConf=$conf;
5922
	
5922
 
5923
		#處理會導致程式無法執行的錯誤
5923
		#處理會導致程式無法執行的錯誤
5924
		set_error_handler(function($errno, $errstr, $errfile, $errline){
5924
		set_error_handler(function($errno, $errstr, $errfile, $errline){
5925
			throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
5925
			throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
5926
			});
5926
			});
5927
 
5927
 
5928
		#處理非導致程式無法執行的錯誤
5928
		#處理非導致程式無法執行的錯誤
5929
		#參考資料:
5929
		#參考資料:
5930
		#http://php.net/manual/en/class.exception.php
5930
		#http://php.net/manual/en/class.exception.php
5931
		set_exception_handler(function($exception){
5931
		set_exception_handler(function($exception){
5932
			
5932
 
5933
			#debug
5933
			#debug
5934
			#var_dump($exception);return true;
5934
			#var_dump($exception);return true;
5935
			
5935
 
5936
			#無窮迴圈
5936
			#無窮迴圈
5937
			while(true){
5937
			while(true){
5938
			
5938
 
5939
				#取得給本函式使用的 conf
5939
				#取得給本函式使用的 conf
5940
				$conf=\qbpwcf\variableCheck::$setErrorHandlerConf;
5940
				$conf=\qbpwcf\variableCheck::$setErrorHandlerConf;
5941
			
5941
 
5942
				#debug
5942
				#debug
5943
				#var_dump(__LINE__,$conf);
5943
				#var_dump(__LINE__,$conf);
5944
				
5944
 
5945
				#初始化儲存錯誤訊息
5945
				#初始化儲存錯誤訊息
5946
				$info=array();
5946
				$info=array();
5947
				
5947
 
5948
				#取得描述
5948
				#取得描述
5949
				$info["msg"]="Uncaught exception: ".$exception->getMessage();
5949
				$info["msg"]="Uncaught exception: ".$exception->getMessage();
5950
				
5950
 
5951
				#取得出錯檔案
5951
				#取得出錯檔案
5952
				$info["file"]="File: ".$exception->getFile();
5952
				$info["file"]="File: ".$exception->getFile();
5953
				
5953
 
5954
				#取得出錯行數
5954
				#取得出錯行數
5955
				$info["line"]="Line: ".$exception->getLine();
5955
				$info["line"]="Line: ".$exception->getLine();
5956
				
5956
 
5957
				#取得錯誤代碼
5957
				#取得錯誤代碼
5958
				$info["code"]="The exception code is: ".$exception->getCode();
5958
				$info["code"]="The exception code is: ".$exception->getCode();
5959
				
5959
 
5960
				#函式說明:
5960
				#函式說明:
5961
				#檢查多個字串中的每個字串是否有多個關鍵字
5961
				#檢查多個字串中的每個字串是否有多個關鍵字
5962
				#回傳結果:
5962
				#回傳結果:
5963
				#$result["status"],整體來說,執行是否成功,"true"代表執行成功,"false"代表執行失敗。
5963
				#$result["status"],整體來說,執行是否成功,"true"代表執行成功,"false"代表執行失敗。
5964
				#$result["function"],當前執行的函數名稱.
5964
				#$result["function"],當前執行的函數名稱.
Line 5981... Line 5981...
5981
				#無.
5981
				#無.
5982
				#備註:
5982
				#備註:
5983
				#無.
5983
				#無.
5984
				$findManyKeyWordsFromManyString=search::findManyKeyWordsFromManyString($conf["search::findManyKeyWordsFromManyString"]);
5984
				$findManyKeyWordsFromManyString=search::findManyKeyWordsFromManyString($conf["search::findManyKeyWordsFromManyString"]);
5985
				unset($conf["search::findManyKeyWordsFromManyString"]);
5985
				unset($conf["search::findManyKeyWordsFromManyString"]);
5986
				
5986
 
5987
				#如果執行失敗
5987
				#如果執行失敗
5988
				if($findManyKeyWordsFromManyString["status"]==="false"){
5988
				if($findManyKeyWordsFromManyString["status"]==="false"){
5989
				
5989
 
5990
					#設置執行失敗
5990
					#設置執行失敗
5991
					$result["status"]="false";
5991
					$result["status"]="false";
5992
					
5992
 
5993
					#設置錯誤資訊
5993
					#設置錯誤資訊
5994
					$result["error"]=$findManyKeyWordsFromManyString;
5994
					$result["error"]=$findManyKeyWordsFromManyString;
5995
				
5995
 
5996
					#debug
5996
					#debug
5997
					var_dump(__LINE__,$result);
5997
					var_dump(__LINE__,$result);
5998
				
5998
 
5999
					#結束執行,回傳代碼1給shell
5999
					#結束執行,回傳代碼1給shell
6000
					exit(1);
6000
					exit(1);
6001
				
6001
 
6002
					}#if end
6002
					}#if end
6003
 
6003
 
6004
				#如果有符合可以繼續執行的條件
6004
				#如果有符合可以繼續執行的條件
6005
				if(count($findManyKeyWordsFromManyString["foundedTrueKey"])>0){
6005
				if(count($findManyKeyWordsFromManyString["foundedTrueKey"])>0){
6006
				
6006
 
6007
					#debug
6007
					#debug
6008
					var_dump(__LINE__,$findManyKeyWordsFromManyString);
6008
					var_dump(__LINE__,$findManyKeyWordsFromManyString);
6009
				
6009
 
6010
					#結束while
6010
					#結束while
6011
					break;
6011
					break;
6012
				
6012
 
6013
					}#if end
6013
					}#if end
6014
					
6014
 
6015
				#如果有要debug
6015
				#如果有要debug
6016
				if($conf["debug"]==="true"){
6016
				if($conf["debug"]==="true"){
6017
				
6017
 
6018
					#判斷要呈現的方式
6018
					#判斷要呈現的方式
6019
					switch($conf["format"]){
6019
					switch($conf["format"]){
6020
						
6020
 
6021
						#如果是 html
6021
						#如果是 html
6022
						case "html":
6022
						case "html":
6023
					
6023
 
6024
							#呈現錯誤訊息
6024
							#呈現錯誤訊息
6025
							echo "<p>".PHP_EOL;
6025
							echo "<p>".PHP_EOL;
6026
							echo "Uncaught exception: ".$exception->getMessage()."<br>".PHP_EOL;
6026
							echo "Uncaught exception: ".$exception->getMessage()."<br>".PHP_EOL;
6027
							echo "File: ".$exception->getFile()."<br>".PHP_EOL;
6027
							echo "File: ".$exception->getFile()."<br>".PHP_EOL;
6028
							echo "Line: ".$exception->getLine()."<br>".PHP_EOL;
6028
							echo "Line: ".$exception->getLine()."<br>".PHP_EOL;
6029
							echo "Trace: ".print_r($exception->getTrace(),true)."<br>".PHP_EOL;
6029
							echo "Trace: ".print_r($exception->getTrace(),true)."<br>".PHP_EOL;
6030
							echo "The exception code is: ".$exception->getCode()."<br>".PHP_EOL;
6030
							echo "The exception code is: ".$exception->getCode()."<br>".PHP_EOL;
6031
						
6031
 
6032
							#跳出 switch
6032
							#跳出 switch
6033
							break;
6033
							break;
6034
						
6034
 
6035
						#如果是 cmd
6035
						#如果是 cmd
6036
						case "cmd";
6036
						case "cmd";
6037
						
6037
 
6038
							#呈現錯誤訊息
6038
							#呈現錯誤訊息
6039
							echo PHP_EOL;
6039
							echo PHP_EOL;
6040
							echo "Uncaught exception: ".$exception->getMessage().PHP_EOL;
6040
							echo "Uncaught exception: ".$exception->getMessage().PHP_EOL;
6041
							echo "File: ".$exception->getFile().PHP_EOL;
6041
							echo "File: ".$exception->getFile().PHP_EOL;
6042
							echo "Line: ".$exception->getLine().PHP_EOL;
6042
							echo "Line: ".$exception->getLine().PHP_EOL;
6043
							echo "Trace: ".print_r($exception->getTrace(),true).PHP_EOL;
6043
							echo "Trace: ".print_r($exception->getTrace(),true).PHP_EOL;
6044
							echo "The exception code is: ".$exception->getCode().PHP_EOL;
6044
							echo "The exception code is: ".$exception->getCode().PHP_EOL;
6045
						
6045
 
6046
							#跳出 switch
6046
							#跳出 switch
6047
							break;
6047
							break;
6048
					
6048
 
6049
						#其他格式
6049
						#其他格式
6050
						default:
6050
						default:
6051
						
6051
 
6052
							#用var_dump
6052
							#用var_dump
6053
							var_dump($info);
6053
							var_dump($info);
6054
					
6054
 
6055
						}#switch end
6055
						}#switch end
6056
					
6056
 
6057
					}#if end
6057
					}#if end
6058
				
6058
 
6059
				#debug
6059
				#debug
6060
				#var_dump(__LINE__,$findManyKeyWordsFromManyString);
6060
				#var_dump(__LINE__,$findManyKeyWordsFromManyString);
6061
				
6061
 
6062
				#結束執行,回傳代碼1給shell
6062
				#結束執行,回傳代碼1給shell
6063
				exit(1);
6063
				exit(1);
6064
			
6064
 
6065
				}#while end
6065
				}#while end
6066
				
6066
 
6067
			#debug
6067
			#debug
6068
			#var_dump(__LINE__,"passed");
6068
			#var_dump(__LINE__,"passed");
6069
			
6069
 
6070
			#視為可以繼續執行
6070
			#視為可以繼續執行
6071
			return true;
6071
			return true;
6072
			
6072
 
6073
			});
6073
			});
6074
			
6074
 
6075
		}#funciton setErrorHandler end
6075
		}#funciton setErrorHandler end
6076
 
6076
 
6077
	}#class variableCheck end
6077
	}#class variableCheck end
6078
 
6078
 
6079
?>
6079
?>