Subversion Repositories php-qbpwcf

Rev

Rev 249 | Rev 255 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

/*

        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
    Copyright (C) 2014~2026 MIN ZHI, CHEN

    This file is part of QBPWCF.

    QBPWCF is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QBPWCF is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.

*/
namespace qbpwcf;

/*
類別說明:
應用 zerossl 的類別.
備註:
無.
*/
class zerossl{

        /*
        #函式說明:
        #當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #必填參數:
        #$method,物件,為物件實體或類別名稱,會自動置入該參數.
        #$arguments,陣列,為呼叫方法時所用的參數.
        #參考資料:
        #__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
        #備註:
        #無.
        */
        public function __call($method,$arguments){

                #取得當前執行的函式
                $result["function"]=__FUNCTION__;

                #設置執行不正常
                $result["status"]="false";

                #設置執行錯誤
                $result["error"][]=__NAMESPACE__ ."/".$method."() 不存在!";

                #設置所丟入的參數
                $result["error"][]=$arguments;

                #回傳結果
                return $result;

                }#function __call end

        /*
        #函式說明:
        #當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #必填參數:
        #$method,物件,為物件實體或類別名稱,會自動置入該參數.
        #$arguments,陣列,為呼叫方法時所用的參數.
        #參考資料:
        #__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
        #備註:
        #無.
        */
        public static function __callStatic($method,$arguments){

                #取得當前執行的函式
                $result["function"]=__FUNCTION__;

                #設置執行不正常
                $result["status"]="false";

                #設置執行錯誤
                $result["error"][]="欲呼叫的". __NAMESPACE__ ."/".$method."() 不存在!";

                #設置所丟入的參數
                $result["error"][]=$arguments;

                #回傳結果
                return $result;

                }#function __callStatic end

        /*
        #函式說明:
        #取得api的資訊
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #$result["content"],api資訊陣列.
        #必填參數:
        #無
        #可省略參數:
        #無
        #參考資料:
        #無.
        #備註:
        #無.
        */
        public static function getApiInfo(){

                #初始化要回傳的陣列
                $result=array();

                #api domain
                $result["apiDomain"]="api.zerossl.com";

                #create certificate api path
                $result["csrPath"]="/certificates";

                #create certificate url
                $result["csrUrl"]=$result["apiDomain"].$result["csrPath"];

                #api access key
                $result["apiKey"]=zeroSSLapiKey;

                #設置執行正常
                $result["status"]="true";

                #回傳結果
                return $result;

                }#function getApiInfo end

        /*
        #函式說明:
        #產生ssl private key.
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #$result["argu"],所使用的參數.
        #$result["curl_verbose_info"],curl執行的詳細資訊.
        #必填參數:
        #$conf["fileArgu"],字串,變數__FILE__的內容.
        $conf["fileArgu"]=__FILE__;
        #可省略參數:
        #$conf["length"],整數,金鑰的長度,預設為 4096(bit).
        #$conf["length"]=4096';
        #參考資料:
        #無.
        #備註:
        #key generated by openssl with RSA.
        */
        public static function createPrivateKey(&$conf){

                #初始化要回傳的結果
                $result=array();

                #取得當前執行的函數名稱
                $result["function"]=__FUNCTION__;

                #如果 $conf 不為陣列
                if(gettype($conf)!="array"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置執行錯誤訊息
                        $result["error"][]="\$conf變數須為陣列形態";

                        #如果傳入的參數為 null
                        if($conf==null){

                                #設置執行錯誤訊息
                                $result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";

                                }#if end

                        #回傳結果
                        return $result;

                        }#if end

                #取得參數
                $result["argu"]=$conf;

                #函式說明:
                #檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["error"],執行不正常結束的錯訊息陣列.
                #$result["simpleError"],簡單表示的錯誤訊息.
                #$result["function"],當前執行的函式名稱.
                #$result["argu"],設置給予的參數.
                #$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
                #$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
                #$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
                #$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息
                #$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.
                #$result["argu"],字串陣列,目前輸入的參數名稱陣列.
                #$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
                #$result["notNeedVar"],字串陣列,多餘的參數名稱.
                #必填參數:
                #$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
                $conf["variableCheck::checkArguments"]["varInput"]=&$conf;
                #$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
                $conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
                #可省略參數:
                #$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("fileArgu");
                #$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object"); , null、any代表不指定變數形態.其中 resource也包含"resource (closed)".
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string");
                #$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
                $conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
                #$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
                #$conf["canNotBeEmpty"]=array();
                #$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
                #$conf["canBeEmpty"]=array();
                #$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
                $conf["variableCheck::checkArguments"]["skipableVariableCanNotBeEmpty"]=array("length");
                #$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["skipableVariableName"]=array("length");
                #$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
                $conf["variableCheck::checkArguments"]["skipableVariableType"]=array("integer");
                #$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
                $conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(4096);
                #$conf["disallowAllSkipableVarIsEmpty"],字串,是否允許每個可省略參數都為空字串,預設為"true"允許,反之為"false".
                #$conf["disallowAllSkipableVarIsEmpty"]="";
                #$conf["disallowAllSkipableVarIsEmptyArray"],字串,是否允許每個可省略參數都為空陣列,預設為"true"允許,反之為"false".
                #$conf["disallowAllSkipableVarIsEmptyArray"]="";
                #$conf["disallowAllSkipableVarNotExist"],字串,是否不允許每個可省略參數都不存在,預設為"false"代表允許,反之為"true".
                #$conf["disallowAllSkipableVarNotExist"]="";
                #$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
                #$conf["arrayCountEqualCheck"][]=array();
                #參考資料:
                #array_keys=>http://php.net/manual/en/function.array-keys.php
                #備註:
                #無.
                $checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
                unset($conf["variableCheck::checkArguments"]);

                #如果 $checkArguments["status"]等於 "false"
                if($checkArguments["status"]==="false"){

                        #設置執行錯誤的識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end

                #如果 $checkArguments["passed"]等於 "false"
                if($checkArguments["passed"]==="false"){

                        #設置執行錯誤的識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end

                #函式說明:
                #呼叫shell執行系統命令,並取得回傳的內容.
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["error"],錯誤訊息陣列.
                #$result["function"],當前執行的函數名稱.
                #$result["argu"],使用的參數.
                #$result["cmd"],執行的指令內容.
                #$result["fullCmd"],如果參數 $conf["inBackGround"] 為 "true" 則會回傳該值.
                #$result["output"],爲執行完二元碼後的輸出陣列,若 $conf["inBackGround"] 為 "true",則為當下的輸出.
                #$result["tmpFileOutput"],儲存輸出的暫存檔案名稱,若 $conf["inBackGround"] 為 "true" 則會回傳該值.
                #$result["running"],是否還在執行.
                #$result["pid"],pid.
                #$result["statusCode"],執行結束後的代碼.
                #$result["escape"],陣列,儲存重新排序過且已經escape過的指令(key為"cmd")與參數(key為"argu")與兩者組合的一維陣列(key為"array").
                #必填參數:
                #$conf["command"],字串,要執行的指令.
                $conf["external::callShell"]["command"]="openssl";
                #$conf["fileArgu"],字串,變數__FILE__的內容.
                $conf["external::callShell"]["fileArgu"]=$conf["fileArgu"];
                #可省略參數:
                #$conf["argu"],陣列字串,指令搭配的參數,預設為空陣列.
                $conf["external::callShell"]["argu"]=array("genrsa",$conf["length"]);
                #$conf["arguIsAddr"],陣列字串,指令搭配的哪些參數為路徑,為路徑的參數會進行轉換以便符合呼叫當前函數的位置,預設不指定,若有3個參數,其中第3個參數為路徑,則表示為array("false","false","true").
                #$conf["arguIsAddr"]=array();
                #$conf["pre"],陣列,要在本指令前執行的每個指令與參數.
                #$conf["pre"][$i]["cmd"],字串,要在本指令前執行的第$i+1個指令.
                #$conf["pre"][$i]["param"],陣列字串,要在本指令前執行的第$i+1個指令的參數.
                #$conf["enablePrintDescription"],字串,是否要印出$conf["printDescription"]的內容,"true"代表要,"false"代表不要,預設為"false".
                #$conf["enablePrintDescription"]="true";
                #$conf["printDescription"],字串,執行該外部程式前要印出來的的文字,預設為$conf["command"]的內容加上使用的$conf["argu"]參數.
                #$conf["printDescription"]="";
                #$conf["escapeshellarg"],字串,是否要啟用過濾參數,用了比較安全,但可能會出錯,"true"為啟用,"false"為不啟用,預設為"false".如果參數為"< 、<< 、> 、>> 、| 、2>&1"之一則不會過濾.
                $conf["external::callShell"]["escapeshellarg"]="true";
                #$conf["thereIsShellVar"],陣列字串,指令搭配的參數"argu",若含有「\'」,則取代為「"」.每個argu參數都要有對應的元素."true"代表要置換.
                #$conf["thereIsShellVar"]=array();
                #$conf["username"],字串,要用什麼使用者來執行,預設為執行php的使用者,該參數不適用於apache環境.
                #$conf["username"]="";
                #$conf["password"],字串,root的使用者密碼,預設不使用密碼,該參數不適用於apache環境.
                #$conf["password"]="";
                #$conf["useScript"],字串,是否要啟用Linux的script指令來記錄輸出,"true"代表要,Fedora的selinux會擋住該操作;"false"代表不要,預設為"false".
                #$conf["useScript"]="";
                #$conf["logFilePath"],字串,當 $conf["useScript"] 為 "true" 時,輸出的內容要暫存到哪裡,預設為 "/tmp/.qbpwcf_tmp/external/callShell/".
                #$conf["logFilePath"]=".qbpwcf_tmp/external/callShell/";
                #$conf["inBackGround"],字串,是否要在背景執行,且不會等待程式執行結束再執行下一個指令,"true"代表是,"false"代表不要,預設為"false",如果$conf["command"]有用「;」區隔的多個指令將會出錯.
                #$conf["inBackGround"]="";
                #$conf["getErr"],字串,"true"代表將錯誤輸出變成標準輸出,反之"false"為不變動.
                #$conf["getErr"]="false";
                #$conf["doNotRun"],字串,"true"代表不執行指令,預設為"false"會執行指令.
                #$conf["doNotRun"]="false";
                #參考資料:
                #exec=>http://php.net/manual/en/function.exec.php
                #escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
                #escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
                #備註:
                #不是所有指令都能用apache的身份執行,目前已知java,javac指令無法執行,使用root身份可能會被selinux阻擋.
                #若使用的 command、argu 參數,含有 ~ 則會被視為字串,若有需要其於 shell 中代表的家目錄位置,可用 fileAccess::tildeToPath 來進行轉換.
                $callShell=external::callShell($conf["external::callShell"]);
                unset($conf["external::callShell"]);

                #如果異常
                if($callShell["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$callShell;

                        #回傳結果
                        return $result;

                        }#if end

                #函式說明:
                #將一維陣列轉換為用特定符號間隔的字串,ex:array("1","2","3") to "a;b;c;".
                #回傳的結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["function"],當前執行的function名稱
                #$result["error"],錯誤訊息陣列.
                #$result["content"],處理好的字串.
                #$result["argu"],使用的參數.
                #必填參數:
                #$conf["inputArray"],字串陣列,要轉成字串的一維陣列.
                $conf["arrays::arrayToString"]["inputArray"]=$callShell["output"];
                #可省略參數:
                #$conf["spiltSymbol"],字串,用來區隔字串的符號,預設為;
                $conf["arrays::arrayToString"]["spiltSymbol"]="";
                #$conf["skipEnd"],字串,結尾是否不要加上符號,預設為"false",要加上符號,"true"代表不要加上符號。
                $conf["arrays::arrayToString"]["skipEnd"]="true";
                #$conf["spiltSymbolAtStart"],字串,是否要在開頭加上spiltSymbol,預設為"false",代表不要;反之為“true”.
                #$conf["spiltSymbolAtStart"]="";
                #參考資料:
                #無.
                #備註:
                #無.
                $arrayToString=arrays::arrayToString($conf["arrays::arrayToString"]);
                unset($conf["arrays::arrayToString"]);

                #如果異常
                if($arrayToString["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$arrayToString;

                        #回傳結果
                        return $result;

                        }#if end

                #取得 private key 字串
                $result["content"]=$arrayToString["content"];

                #設置執行正常
                $result["status"]="true";

                #回傳結果
                return $result;

                }#function createPrivateKey end

        /*
        #函式說明:
        #產生certificate sign request(CSR).
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #$result["argu"],所使用的參數.
        #$result["curl_verbose_info"],curl執行的詳細資訊.
        #必填參數:
        #$conf["domain"],字串,csr內容的網域名稱.
        #$conf["domain"]="";
        #可省略參數:
        #$conf["country"],字串,csr內容的國家名稱,預設為"TW".
        #$conf["country"]="";
        #$conf["state"],字串,csr內容的State名稱,預設為"Taiwan".
        #$conf["state"]="";
        #$conf["org"],字串,csr內容的組織名稱,預設為"QBPWCF".
        #$conf["org"]="";
        #$conf["unit"],字串,csr內容的組織所屬單位,預設為"RD".
        #$conf["unit"]="";
        #參考資料:
        #無.
        #備註:
        #無.
        */
        public static function createCSR(&$conf){
        
                #初始化要回傳的結果
                $result=array();

                #設置當其函數名稱
                $result["function"]=__FUNCTION__;

                #如果 $conf 不為陣列
                if(gettype($conf)!="array"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置執行錯誤訊息
                        $result["error"][]="\$conf變數須為陣列形態";

                        #如果傳入的參數為 null
                        if($conf==null){

                                #設置執行錯誤訊息
                                $result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";

                                }#if end

                        #回傳結果
                        return $result;

                        }#if end

                #取得參數
                $result["argu"]=$conf;

                #檢查參數
                #函式說明:
                #檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
                #$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
                #$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
                #$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息
                #$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.
                #$result["argu"],字串陣列,目前輸入的參數名稱陣列.
                #$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
                #$result["notNeedVar"],字串陣列,多餘的參數名稱.
                #必填寫的參數:
                #$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
                $conf["variableCheck::checkArguments"]["varInput"]=&$conf;
                #$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("domain");
                #$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string");
                #$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
                $conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
                #可以省略的參數:
                #$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
                $conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
                #$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或集合.
                #$conf["skipableVariableCanNotBeEmpty"]=array();
                #$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["skipableVariableName"]=array("country","state","city","org","unit");
                #$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
                $conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","string","string","string","string");
                #$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
                $conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("TW","Taiwan","Taoyuan City","QBPWCF","RD");
                #$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
                #$conf["arrayCountEqualCheck"][]=array();
                #參考資料來源:
                #array_keys=>http://php.net/manual/en/function.array-keys.php
                $checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
                unset($conf["variableCheck::checkArguments"]);

                #如果檢查失敗
                if($checkArguments["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end

                #如果檢查不通過
                if($checkArguments["passed"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end
                
                #產生uuid名稱
                #函式說明:
                #使用 linux 的 uuid 指令來產生 uuid 字串
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["error"],錯誤訊息.
                #$result["function"],當前執行的函式名稱.
                #$result["content"],uuid.
                #必填參數:
                #無.
                #可省略參數:
                #無.
                #參考資料:
                #無.
                #備註:
                #無.
                $uuid=cmd::uuid();
                
                #如果執行異常
                if($uuid["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$uuid;

                        #回傳結果
                        return $result;

                        }#if end
                
                #取得暫存的檔案名稱
                $TFN=$uuid["content"];
                
                #函式說明:
                #於本套件位置底下的tmp資料夾下建立與回傳暫存檔案名稱路徑
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["error"],錯誤訊息.
                #$result["function"],當前執行的函數名稱.
                #$result["content"],暫存檔案的路徑與名稱.
                #$result["fileName"],暫存檔案的名稱.
                #$result["path"],暫存檔案的路徑.
                #必填參數:
                #無.
                #可省略參數:
                #$conf["content"],陣列,每行檔案的內容,預設為空陣列,不寫入任何資料.
                #$conf["contant"]=array();
                #參考資料:
                #無.
                #備註:
                #無.
                $conf["fileAccess::createTempFile"]=array();
                $createTempFile=fileAccess::createTempFile($conf["fileAccess::createTempFile"]);
                unset($conf["fileAccess::createTempFile"]);
                
                #如果執行異常
                if($createTempFile["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$createTempFile;

                        #回傳結果
                        return $result;

                        }#if end
                
                #暫存的檔案路徑與名稱
                $TFN=$createTempFile["content"];
                
                #產生 privae key
                #openssl genrsa -out output.key 4096 
                
                #函式說明:
                #呼叫shell執行系統命令,並取得回傳的內容.
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["error"],錯誤訊息陣列.
                #$result["function"],當前執行的函數名稱.
                #$result["argu"],使用的參數.
                #$result["cmd"],執行的指令內容.
                #$result["fullCmd"],如果參數 $conf["inBackGround"] 為 "true" 則會回傳該值.
                #$result["output"],爲執行完後的輸出陣列,若 $conf["inBackGround"] 為 "true",則為當下的輸出.
                #$result["content"],為執行完後的輸出字串.
                #$result["tmpFileOutput"],儲存輸出的暫存檔案名稱,若 $conf["inBackGround"] 為 "true" 則會回傳該值.
                #$result["running"],是否還在執行.
                #$result["pid"],pid.
                #$result["statusCode"],執行結束後的代碼.
                #$result["escape"],陣列,儲存重新排序過且已經escape過的指令(key為"cmd")與參數(key為"argu")與兩者組合的一維陣列(key為"array").
                #$result["noEcaped"],陣列,儲存重新排序過未經過escape過的指令(key為"cmd")與參數(key為"argu")與兩者組合的一維陣列(key為"array").
                #必填參數:
                #$conf["command"],字串,要執行的指令.
                $conf["external::callShell"]["command"]="openssl";
                #$conf["fileArgu"],字串,變數__FILE__的內容.
                $conf["external::callShell"]["fileArgu"]=__FILE__;
                #可省略參數:
                #$conf["argu"],陣列字串,指令搭配的參數,預設為空陣列.
                $conf["external::callShell"]["argu"]=array("genrsa","-out",$TFN,"4096");
                #$conf["arguIsAddr"],陣列字串,指令搭配的哪些參數為路徑,為路徑的參數會進行轉換以便符合呼叫當前函數的位置,預設不指定,若有3個參數,其中第3個參數為路徑,則表示為array("false","false","true").
                #$conf["arguIsAddr"]=array();
                #$conf["pre"],陣列,要在本指令前執行的每個指令與參數.
                #$conf["pre"][$i]["cmd"],字串,要在本指令前執行的第$i+1個指令.
                #$conf["pre"][$i]["param"],陣列字串,要在本指令前執行的第$i+1個指令的參數.
                #$conf["enablePrintDescription"],字串,是否要印出$conf["printDescription"]的內容,"true"代表要,"false"代表不要,預設為"false".
                #$conf["enablePrintDescription"]="true";
                #$conf["printDescription"],字串,執行該外部程式前要印出來的的文字,預設為$conf["command"]的內容加上使用的$conf["argu"]參數.
                #$conf["printDescription"]="";
                #$conf["escapeshellarg"],字串,是否要啟用過濾參數,用了比較安全,但可能會出錯,"true"為啟用,"false"為不啟用,預設為"false".如果參數為"< 、<< 、> 、>> 、| 、2>&1"之一則不會過濾.
                #$conf["escapeshellarg"]="false";
                #$conf["thereIsShellVar"],陣列字串,指令搭配的參數"argu",若含有「\'」,則取代為「"」.每個argu參數都要有對應的元素."true"代表要置換.
                #$conf["thereIsShellVar"]=array();
                #$conf["username"],字串,要用什麼使用者來執行,預設為執行php的使用者,該參數不適用於apache環境.
                #$conf["username"]="";
                #$conf["password"],字串,root的使用者密碼,預設不使用密碼,該參數不適用於apache環境.
                #$conf["password"]="";
                #$conf["useScript"],字串,是否要啟用Linux的script指令來記錄輸出,"true"代表要,Fedora的selinux會擋住該操作;"false"代表不要,預設為"false".
                #$conf["useScript"]="";
                #$conf["logFilePath"],字串,當 $conf["useScript"] 為 "true" 時,輸出的內容要暫存到哪裡,預設為 "/tmp/.qbpwcf_tmp/external/callShell/".
                #$conf["logFilePath"]=".qbpwcf_tmp/external/callShell/";
                #$conf["inBackGround"],字串,是否要在背景執行,且不會等待程式執行結束再執行下一個指令,"true"代表是,"false"代表不要,預設為"false",如果$conf["command"]有用「;」區隔的多個指令將會出錯.
                #$conf["inBackGround"]="";
                #$conf["getErr"],字串,"true"代表將錯誤輸出變成標準輸出,反之"false"為不變動.
                #$conf["getErr"]="false";
                #$conf["doNotRun"],字串,"true"代表不執行指令,預設為"false"會執行指令.
                $conf["external::callShell"]["doNotRun"]="true";
                #參考資料:
                #exec=>http://php.net/manual/en/function.exec.php
                #escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
                #escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
                #備註:
                #不是所有指令都能用apache的身份執行,目前已知java,javac指令無法執行,使用root身份可能會被selinux阻擋.
                #若使用的 command、argu 參數,含有 ~ 則會被視為字串,若有需要其於 shell 中代表的家目錄位置,可用 fileAccess::tildeToPath 來進行轉換.
                $callShell=external::callShell($conf["external::callShell"]);
                unset($conf["external::callShell"]);
                
                #如果執行異常
                if($callShell["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$callShell;

                        #回傳結果
                        return $result;

                        }#if end
                
                #debug
                #var_dump(__LINE__,$callShell);exit;
                
                #函式說明:
                #透過proc來多執行序運作.
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["argu"],使用的參數.
                #$result["content"],陣列,每個元素為其指令執行的結果訊息陣列,key為"status"代表執行是否正常的識別;key為"statusCode"代表程式結束後回傳給對應executeBy程式的數值,若為"?"則代表程序尚未結束,若為整數0,則代表順利執行結束,可透過proc_update函式進行資訊的更新與取得;key為"output"代表標準輸出,若為resource,則代表為pipe;key為"error"代表非標準輸出,若為resource,則代表為pipe;key為"input"代表成功輸入的指令;key為"process"代表該程序經proc_open後的process source;key為"proc_get_status"代表程序的資訊.
                #必填參數:
                #$conf["cmds"],字串陣列,每個元素代表單一程序要執行的指令與參數.
                $conf["threads::proc"]["cmds"]=array($callShell["cmd"]);
                #可省略參數:
                #$conf["wait"],字串,是否需要等待所有程序結束,預設為"true"要等待;反之為"false"不要等待.
                $conf["threads::proc"]["wait"]="true";
                #$conf["timeout"],字串陣列,每個元素代表單一程序執行的最大等待秒數,超過後將會強迫停止執行,僅當wait參數為"true"時生效.
                #$conf["timeout"]=array("10");
                #$conf["workingDir"],字串陣列,個別程式執行時的家目錄,預設不指定.
                #$conf["workingDir"]=array("path");
                #$conf["envs"],2維字串陣列,每個元素代表個別程式執行時的指定環境變數,key變數名稱;value為變數內容.預設為array("QBPWCF" => "Quick Build PHP Website Componment base on Fedora Linux");
                #$conf["envs"]=array(array("key"=>"value"));
                #$conf["executeBy"],字串陣列,每個元素代表個別指令要用什麼程式執行,預設為"bash".
                #$conf["executeBy"]=array("bash");
                #參考資料:
                #https://www.php.net/manual/en/function.proc-open.php
                #https://www.php.net/manual/en/function.proc-get-status.php
                #https://www.php.net/manual/en/function.proc-terminate.php
                #備註:
                #若需要取得當下的執行狀況,請使用 self::proc_update 來更新.
                $proc=threads::proc($conf["threads::proc"]);
                unset($conf["threads::proc"]);
                
                #如果執行異常
                if($proc["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$proc;

                        #回傳結果
                        return $result;

                        }#if end
                
                #debug
                #var_dump(__LINE__,$proc);exit;
                
                #如果執行異常
                if($proc["content"][0]["status"]==="false"){
                
                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$proc["content"][0]["error"];

                        #回傳結果
                        return $result;
                
                        }#if end
                
                #儲存錯誤訊息
                $errorMsg=$proc["content"][0]["error"];
                
                #如果有錯誤訊息
                if(!empty($errorMsg)){
                
                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$errorMsg;

                        #回傳結果
                        return $result;
                
                        }#if end
                
                #範例指令
                #C,國家,例如TW,代表Taiwan
                #ST,州、省,要完整名稱,例如:Taiwan
                #L,城市名稱,例如Taoyuan City.
                #O=,組織或公司名稱,例如QBPWCF.
                #OU,單位名稱,例如RD.
                #CN,網域名稱,例如www.qbpwcf.org
                #openssl req -new -key qbpwcf.org.key -out qbpwcf.org.csr "-subj=/C=TW/ST=Taiwan/L=Taoyuan City/O=QBPWCF/OU=RD/CN=www.qbpwcf.org/"
                
                #初始化subj參數
                $subjStr="-subj=/";
                
                #設置 Country 參數
                $subjStr=$subjStr."C=".$conf["country"]."/";
                
                #設置 State 參數
                $subjStr=$subjStr."ST=".$conf["state"]."/";
                
                #設置 city 參數
                $subjStr=$subjStr."L=".$conf["city"]."/";
                
                #設置 Org 參數
                $subjStr=$subjStr."O=".$conf["org"]."/";
                
                #設置 Unit 參數
                $subjStr=$subjStr."OU=".$conf["unit"]."/";
                
                #設置 domain name 參數
                $subjStr=$subjStr."CN=".$conf["domain"]."/";
                
                #函式說明:
                #呼叫shell執行系統命令,並取得回傳的內容.
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["error"],錯誤訊息陣列.
                #$result["function"],當前執行的函數名稱.
                #$result["argu"],使用的參數.
                #$result["cmd"],執行的指令內容.
                #$result["fullCmd"],如果參數 $conf["inBackGround"] 為 "true" 則會回傳該值.
                #$result["output"],爲執行完後的輸出陣列,若 $conf["inBackGround"] 為 "true",則為當下的輸出.
                #$result["content"],為執行完後的輸出字串.
                #$result["tmpFileOutput"],儲存輸出的暫存檔案名稱,若 $conf["inBackGround"] 為 "true" 則會回傳該值.
                #$result["running"],是否還在執行.
                #$result["pid"],pid.
                #$result["statusCode"],執行結束後的代碼.
                #$result["escape"],陣列,儲存重新排序過且已經escape過的指令(key為"cmd")與參數(key為"argu")與兩者組合的一維陣列(key為"array").
                #$result["noEcaped"],陣列,儲存重新排序過未經過escape過的指令(key為"cmd")與參數(key為"argu")與兩者組合的一維陣列(key為"array").
                #必填參數:
                #$conf["command"],字串,要執行的指令.
                $conf["external::callShell"]["command"]="openssl";
                #$conf["fileArgu"],字串,變數__FILE__的內容.
                $conf["external::callShell"]["fileArgu"]=__FILE__;
                #可省略參數:
                #$conf["argu"],陣列字串,指令搭配的參數,預設為空陣列.
                $conf["external::callShell"]["argu"]=array("req","-new","-key",$TFN,$subjStr);
                #$conf["arguIsAddr"],陣列字串,指令搭配的哪些參數為路徑,為路徑的參數會進行轉換以便符合呼叫當前函數的位置,預設不指定,若有3個參數,其中第3個參數為路徑,則表示為array("false","false","true").
                #$conf["arguIsAddr"]=array();
                #$conf["pre"],陣列,要在本指令前執行的每個指令與參數.
                #$conf["pre"][$i]["cmd"],字串,要在本指令前執行的第$i+1個指令.
                #$conf["pre"][$i]["param"],陣列字串,要在本指令前執行的第$i+1個指令的參數.
                #$conf["enablePrintDescription"],字串,是否要印出$conf["printDescription"]的內容,"true"代表要,"false"代表不要,預設為"false".
                #$conf["enablePrintDescription"]="true";
                #$conf["printDescription"],字串,執行該外部程式前要印出來的的文字,預設為$conf["command"]的內容加上使用的$conf["argu"]參數.
                #$conf["printDescription"]="";
                #$conf["escapeshellarg"],字串,是否要啟用過濾參數,用了比較安全,但可能會出錯,"true"為啟用,"false"為不啟用,預設為"false".如果參數為"< 、<< 、> 、>> 、| 、2>&1"之一則不會過濾.
                $conf["external::callShell"]["escapeshellarg"]="true";
                #$conf["thereIsShellVar"],陣列字串,指令搭配的參數"argu",若含有「\'」,則取代為「"」.每個argu參數都要有對應的元素."true"代表要置換.
                #$conf["thereIsShellVar"]=array();
                #$conf["username"],字串,要用什麼使用者來執行,預設為執行php的使用者,該參數不適用於apache環境.
                #$conf["username"]="";
                #$conf["password"],字串,root的使用者密碼,預設不使用密碼,該參數不適用於apache環境.
                #$conf["password"]="";
                #$conf["useScript"],字串,是否要啟用Linux的script指令來記錄輸出,"true"代表要,Fedora的selinux會擋住該操作;"false"代表不要,預設為"false".
                #$conf["useScript"]="";
                #$conf["logFilePath"],字串,當 $conf["useScript"] 為 "true" 時,輸出的內容要暫存到哪裡,預設為 "/tmp/.qbpwcf_tmp/external/callShell/".
                #$conf["logFilePath"]=".qbpwcf_tmp/external/callShell/";
                #$conf["inBackGround"],字串,是否要在背景執行,且不會等待程式執行結束再執行下一個指令,"true"代表是,"false"代表不要,預設為"false",如果$conf["command"]有用「;」區隔的多個指令將會出錯.
                #$conf["inBackGround"]="";
                #$conf["getErr"],字串,"true"代表將錯誤輸出變成標準輸出,反之"false"為不變動.
                #$conf["getErr"]="false";
                #$conf["doNotRun"],字串,"true"代表不執行指令,預設為"false"會執行指令.
                $conf["external::callShell"]["doNotRun"]="true";
                #參考資料:
                #exec=>http://php.net/manual/en/function.exec.php
                #escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
                #escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
                #備註:
                #不是所有指令都能用apache的身份執行,目前已知java,javac指令無法執行,使用root身份可能會被selinux阻擋.
                #若使用的 command、argu 參數,含有 ~ 則會被視為字串,若有需要其於 shell 中代表的家目錄位置,可用 fileAccess::tildeToPath 來進行轉換.
                $callShell=external::callShell($conf["external::callShell"]);
                unset($conf["external::callShell"]);
                
                #如果執行異常
                if($callShell["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$callShell;

                        #回傳結果
                        return $result;

                        }#if end
                
                #debug
                #var_dump(__LINE__,$callShell);exit;
                
                #函式說明:
                #透過proc來多執行序運作.
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["argu"],使用的參數.
                #$result["content"],陣列,每個元素為其指令執行的結果訊息陣列,key為"status"代表執行是否正常的識別;key為"statusCode"代表程式結束後回傳給對應executeBy程式的數值,若為"?"則代表程序尚未結束,若為整數0,則代表順利執行結束,可透過proc_update函式進行資訊的更新與取得;key為"output"代表標準輸出,若為resource,則代表為pipe;key為"error"代表非標準輸出,若為resource,則代表為pipe;key為"input"代表成功輸入的指令;key為"process"代表該程序經proc_open後的process source;key為"proc_get_status"代表程序的資訊.
                #必填參數:
                #$conf["cmds"],字串陣列,每個元素代表單一程序要執行的指令與參數.
                $conf["threads::proc"]["cmds"]=array($callShell["cmd"]);
                #可省略參數:
                #$conf["wait"],字串,是否需要等待所有程序結束,預設為"true"要等待;反之為"false"不要等待.
                $conf["threads::proc"]["wait"]="true";
                #$conf["timeout"],字串陣列,每個元素代表單一程序執行的最大等待秒數,超過後將會強迫停止執行,僅當wait參數為"true"時生效.
                #$conf["timeout"]=array("10");
                #$conf["workingDir"],字串陣列,個別程式執行時的家目錄,預設不指定.
                #$conf["workingDir"]=array("path");
                #$conf["envs"],2維字串陣列,每個元素代表個別程式執行時的指定環境變數,key變數名稱;value為變數內容.預設為array("QBPWCF" => "Quick Build PHP Website Componment base on Fedora Linux");
                #$conf["envs"]=array(array("key"=>"value"));
                #$conf["executeBy"],字串陣列,每個元素代表個別指令要用什麼程式執行,預設為"bash".
                #$conf["executeBy"]=array("bash");
                #參考資料:
                #https://www.php.net/manual/en/function.proc-open.php
                #https://www.php.net/manual/en/function.proc-get-status.php
                #https://www.php.net/manual/en/function.proc-terminate.php
                #備註:
                #若需要取得當下的執行狀況,請使用 self::proc_update 來更新.
                $proc=threads::proc($conf["threads::proc"]);
                unset($conf["threads::proc"]);
                
                #如果執行異常
                if($proc["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$proc;

                        #回傳結果
                        return $result;

                        }#if end
                        
                #如果執行異常
                if($proc["content"][0]["status"]==="false"){
                
                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$proc["content"][0]["error"];

                        #回傳結果
                        return $result;
                
                        }#if end
                
                #debug
                #var_dump(__LINE__,$proc);exit;
                
                #儲存csr
                $csr=$proc["content"][0]["content"];
                
                #取得 csr 內容
                $result["content"]=$csr;
                
                #移除private key
                #函式說明:
                #移除檔案
                #回傳結果:
                #$result["status"],"true"代表移除成功,"false"代表移除失敗.
                #$result["error"],錯誤訊息陣列.
                #$result["warning"],警告訊息陣列.
                #$result["function"],當前執行的函數名稱.
                #$result["argu"],當前函式使用的參數.
                #必填參數:
                #$conf["fileAddress"],字串,要移除檔案的位置.
                $conf["fileAccess::delFile"]["fileAddress"]=$TFN;
                #$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑.
                $conf["fileAccess::delFile"]["fileArgu"]=__FILE__;
                #可省略參數:
                #$conf["commentsArray"],字串陣列,提示的文字描述,$conf["commentsArray"][$i]代表第($+1)行的描述.
                #$conf["commentsArray"]=array("");
                #$conf["allowDelSymlink"],字串,預設為"false",不移除軟連結;"true"代表要移除軟連結.
                #$conf["allowDelSymlink"]="true";
                #$conf["allowDelFolder"],字串,預設為"false",不移除目錄;"true"代表要移除目錄.
                #$conf["allowDelFolder"]="true";
                #參考資料:
                #無.
                #備註:
                #無.
                $delFile=fileAccess::delFile($conf["fileAccess::delFile"]);
                unset($conf["fileAccess::delFile"]);
                
                #如果執行異常
                if($delFile["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$delFile;

                        #回傳結果
                        return $result;

                        }#if end
                
                #設置執行正常
                $result["status"]="true";
                
                #回傳結果
                return $result;
                
                }#function createCSR end

        /*
        #函式說明:
        #提供certificate sign request(CSR)透過zerossl產生cergificate.
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #$result["argu"],所使用的參數.
        #$result["curl_verbose_info"],curl執行的詳細資訊.
        #$result["id"],用於zerossl api驗證domain的id.
        #$result["content"],字串,得到的json字串回應.
        #$result["cnameKey"],用於dns CNAME驗證鍵名.
        #$result["cnameVal"],用於dms CNAME驗證鍵值.
        #必填參數:
        #$conf["certificate_domains"],字串,要簽署的doamin名稱.
        $conf["certificate_domains"]="";
        #$conf["certificate_csr"],字串,簽署的資訊.
        $conf["certificate_csr"]="";
        #$conf["fileArgu"],字串,變數__FILE__的內容.
        $conf["fileArgu"]=__FILE__;
        #可省略參數:
        #$conf["apiDomain"],字串,提供服務的domain,預設為 self::getApiInfo()["doamin"].
        #$conf["apiDomain"]=self::getApiInfo()["doamin"];
        #$conf["path"],字串,提供服務的path,預設為 self::getApiInfo()["csrPath"].
        #$conf["path"]=self::getApiInfo()["csrPath"];
        #$conf["key"],字串,api key,預設為 self::getApiInfo()["apiKey"].
        #$conf["key"]=self::getApiInfo()["apiKey"];
        #參考資料:
        #無.
        #備註:
        #無.
        */
        public static function createCertificate(&$conf){

                #break point
                #var_dump(self::getApiInfo());exit;

                #初始化要回傳的結果
                $result=array();

                #設置當其函數名稱
                $result["function"]=__FUNCTION__;

                #如果 $conf 不為陣列
                if(gettype($conf)!="array"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置執行錯誤訊息
                        $result["error"][]="\$conf變數須為陣列形態";

                        #如果傳入的參數為 null
                        if($conf==null){

                                #設置執行錯誤訊息
                                $result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";

                                }#if end

                        #回傳結果
                        return $result;

                        }#if end

                #取得參數
                $result["argu"]=$conf;

                #檢查參數
                #函式說明:
                #檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
                #$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
                #$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
                #$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息
                #$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.
                #$result["argu"],字串陣列,目前輸入的參數名稱陣列.
                #$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
                #$result["notNeedVar"],字串陣列,多餘的參數名稱.
                #必填寫的參數:
                #$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
                $conf["variableCheck::checkArguments"]["varInput"]=&$conf;
                #$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("fileArgu","certificate_domains","certificate_csr");
                #$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string","string");
                #$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
                $conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
                #可以省略的參數:
                #$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
                $conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
                #$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或集合.
                #$conf["skipableVariableCanNotBeEmpty"]=array();
                #$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["skipableVariableName"]=array("apiDomain","path","key");
                #$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
                $conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","string","string");
                #$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
                $conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(self::getApiInfo()["apiDomain"],self::getApiInfo()["csrPath"],self::getApiInfo()["apiKey"]);
                #$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
                #$conf["arrayCountEqualCheck"][]=array();
                #參考資料來源:
                #array_keys=>http://php.net/manual/en/function.array-keys.php
                $checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
                unset($conf["variableCheck::checkArguments"]);

                #如果檢查失敗
                if($checkArguments["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end

                #如果檢查不通過
                if($checkArguments["passed"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end

                #要傳送的 key -> value
                $postArray=array();

                #設置要簽署的domain
                $postArray["certificate_domains"]=$conf["certificate_domains"];

                #設置csr
                $postArray["certificate_csr"]=$conf["certificate_csr"];

                #預設為 90 天的憑證
                $postArray["certificate_validity_days"]=90;

                #強制讓 要簽署的domain 為 $postArray["certificate_domains"]
                $postArray["strict_domains"]=1;

                #設置要傳送的 json
                $postJson=json_encode($postArray);

                #函式說明:
                #運行curl cmd
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["error"],錯誤訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["founded"],識別網址找不找得到.
                #$result["content"],取得的回應內容陣列;若$conf["bgInProc"]為"true",則每個元素為其指令執行的結果訊息陣列,key為"status"代表執行是否正常的識別;key為"statusCode"代表程式結束後回傳給對應executeBy程式的數值;key為"output"代表標準輸出,若為resource,則代表為pipe;key為"error"代表非標準輸出,若為resource,則代表為pipe;key為"input"代表成功輸入的指令;key為"process"代表該程序經proc_open後的process source;key為"proc_get_status"代表程序的資訊.
                #$result["fullContent"],取得回應的完整字串內容.
                #$result["cookie"],cookie檔案的位置與名稱.
                #$result["cmd"],執行的command.
                #$result["argu],使用的參數.
                #必填參數:
                #$conf["url"],字串,目標url.
                $conf["catchWebContent::curlCmd"]["url"]="https://".$conf["apiDomain"].$conf["path"]."?access_key=".$conf["key"];
                #$conf["fileArgu"],字串,變數__FILE__的內容.
                $conf["catchWebContent::curlCmd"]["fileArgu"]=$conf["fileArgu"];
                #可省略參數:
                #$conf["header"],字串陣列,要傳送的header.
                $conf["catchWebContent::curlCmd"]["header"]=array("content-type: application/json");
                #$conf["allowAnySSLcertificate"],字串,是否允許不可信任的SSL憑證,預設為"true".
                #$conf["allowAnySSLcertificate"]="";
                #$conf["postVar"],字串陣列,每個要傳送的post變數名稱(陣列的key值)與數值.
                #$conf["postVar"]=array();
                #$conf["rawPost"]="字串",要傳送的raw post內容.
                $conf["catchWebContent::curlCmd"]["rawPost"]=$postJson;
                #$conf["urlEncode"],字串,post的內容是否要url_encode,"true"代表要,預設為"false"代表不要.
                #$conf["catchWebContent::curlCmd"]["urlEncode"]="true";
                #$conf["agent"],字串,user agent的名稱.
                #$conf["agent"]="";
                #$conf["cookie"],字串,cookie位置與檔案位置.
                #$conf["cookie"]="";
                #$conf["forceNewCookie"],字串,是否要重置cookie,"true"代表要,"false"代表不要,預設為"false".
                #$conf["forceNewCookie"]="";
                #$conf["inBg"],字串,"true"代表要在背景中執行;反之則為"false".
                #$conf["inBg"]="true";
                #$conf["bgInPorc"],字串,若跟inBg一樣為"true",則會透過proc放在背景執行且回傳proc資訊,以便監控執行狀況.預設為"false",不使用proc.
                #$conf["bgInProc"]="false";
                #參考資料:
                #無.
                #備註:
                #無.
                $curlCmd=catchWebContent::curlCmd($conf["catchWebContent::curlCmd"]);
                unset($conf["catchWebContent::curlCmd"]);

                #如果異常
                if($curlCmd["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$curlCmd;

                        #回傳結果
                        return $result;

                        }#if end

                #設置curl的詳細資訊
                $result["curl_verbose_info"]=$curlCmd;

                /* 範例 json content
                {"id":"de9bfbbc78ad2b04323ac0670efefe58","type":"1","common_name":"qbpwcf.org","additional_domains":"","created":"2026-01-19 11:47:13","expires":"2026-04-19 23:59:59","status":"draft","validation_type":null,"validation_emails":null,"replacement_for":"","fingerprint_sha1":null,"brand_validation":null,"validation":{"email_validation":{"qbpwcf.org":["admin@qbpwcf.org","administrator@qbpwcf.org","hostmaster@qbpwcf.org","postmaster@qbpwcf.org","webmaster@qbpwcf.org"]},"other_methods":{"qbpwcf.org":{"file_validation_url_http":"http:\/\/qbpwcf.org\/.well-known\/pki-validation\/3FE7CA1D6DA057FB40FDD333B4C105F9.txt","file_validation_url_https":"https:\/\/qbpwcf.org\/.well-known\/pki-validation\/3FE7CA1D6DA057FB40FDD333B4C105F9.txt","file_validation_content":["7B29341B7148276F5025CE90FC1138037871040E5B7FBDB8E7EEF7CC8DAA4A56","comodoca.com","2e85598b7f1b864"],"cname_validation_p1":"_3FE7CA1D6DA057FB40FDD333B4C105F9.qbpwcf.org","cname_validation_p2":"7B29341B7148276F5025CE90FC113803.7871040E5B7FBDB8E7EEF7CC8DAA4A56.2e85598b7f1b864.comodoca.com"}}},"signature_algorithm_properties":null}
                */

                #驗證結果是否為 json
                $json_validate=json_validate($curlCmd["fullContent"]);

                #如果回應不是 json
                if(!$json_validate){
                
                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$curlCmd;

                        #回傳結果
                        return $result;
                
                        }#if end

                #設置json string結果
                $result["content"]=$curlCmd["fullContent"];

                #解析json
                $jsonRes=json_decode($result["content"]);

                #取得用於 dns CNAME 驗證的名稱
                $result["cnameKey"]=$jsonRes->validation->other_methods->$conf["certificate_domains"]->cname_validation_p1;

                #取得用於 dns CNAME 驗證的數值
                $result["cnameVal"]=$jsonRes->validation->other_methods->$conf["certificate_domains"]->cname_validation_p2;

                #取得用於認證domain時識別用的id
                $result["id"]=$jsonRes->id;

                #設置執行正常
                $result["status"]="true";

                #回傳結果
                return $result;

                }#function createCertificate end

        /*
        #函式說明:
        #新增DNS記錄到檔案裡面.
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #$result["argu"],所使用的參數.
        #$result["content"],字串陣列,更新後的檔案RR(DNS記錄).
        #$result["content"]["domain"],字串,RR所屬domain.
        #$result["content"]["defaultTTL"],字串,預設的RR更新時間.
        #$result["comment"],字串陣列,逐行的註解.
        #必填參數:
        #$conf["add"],多維陣列,每個元素有為有三個元素的陣列,key有"query"跟"update"跟"type"跟"value"以及"comment",分別代表要查詢的數值、更新周期、類型、答案、註解.
        $conf["add"]=array();
        #$conf["dnsRecordFile"],字串,該ZONE檔案位置與名稱.
        $conf["dnsRecordFile"]="";
        #可省略參數:
        #$conf["writeNow"],字串,是否要直接寫入既有ZONE檔案,預設為"false",不寫入;"true"為直接覆寫內容.
        #$conf["writeNow"]="false";
        #$conf["debug"],字串,是否要開啟debug模式,預設為"false"不開啟;反之為"true"要開啟,會在/tmp/建立debug檔案zerossl\:\:updateDnsRecordFile.
        #$conf["debug"]="false";
        #參考資料:
        #無.
        #備註:
        #目前支援的DNS記錄檔案是給bind(Berkeley Internet Name Domain)套件使用的.
        #通常qbpwcf使用者沒有權限存取RR(dns記錄檔案),本套件是透過sshfs掛載來繞過該問題.
        #php-pear上的Net_DNS2也可以解析RR.
        */
        public static function updateDnsRecordFile(&$conf){
        
                #初始化要回傳的結果
                $result=array();

                #設置當其函數名稱
                $result["function"]=__FUNCTION__;

                #如果 $conf 不為陣列
                if(gettype($conf)!="array"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置執行錯誤訊息
                        $result["error"][]="\$conf變數須為陣列形態";

                        #如果傳入的參數為 null
                        if($conf==null){

                                #設置執行錯誤訊息
                                $result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";

                                }#if end

                        #回傳結果
                        return $result;

                        }#if end

                #取得參數
                $result["argu"]=$conf;

                #檢查參數
                #函式說明:
                #檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
                #$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
                #$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
                #$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息
                #$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.
                #$result["argu"],字串陣列,目前輸入的參數名稱陣列.
                #$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
                #$result["notNeedVar"],字串陣列,多餘的參數名稱.
                #必填寫的參數:
                #$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
                $conf["variableCheck::checkArguments"]["varInput"]=&$conf;
                #$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("add","dnsRecordFile");
                #$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("array","string");
                #$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
                $conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
                #可以省略的參數:
                #$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
                $conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
                #$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或集合.
                #$conf["skipableVariableCanNotBeEmpty"]=array();
                #$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["skipableVariableName"]=array("writeNow","debug");
                #$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
                $conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","string");
                #$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
                $conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("false","false");
                #$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
                #$conf["arrayCountEqualCheck"][]=array();
                #參考資料來源:
                #array_keys=>http://php.net/manual/en/function.array-keys.php
                $checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
                unset($conf["variableCheck::checkArguments"]);

                #如果檢查失敗
                if($checkArguments["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end

                #如果檢查不通過
                if($checkArguments["passed"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end
                
                #初始化要回傳的content
                $result["content"]=array();
                
                #初始化儲存逐行的註解.
                $result["comment"]=array();
                
                #預設的zone file domain為空
                $result["domain"]="";
                
                #預設的 update 時間
                $result["defaultTTL"]=3600;
                
                #取得 dns 記錄檔案的內容
                #函式說明:
                #依據行號分隔抓取檔案的內容,結果會回傳一個陣列
                #回傳的變數說明:
                #$result["status"],執行是否成功,"true"代表成功;"fasle"代表失敗.
                #$result["error"],錯誤訊息提示.
                #$result["warning"],警告訊息.
                #$result["function"],當前執行的函數名稱.
                #$result["fileContent"],爲檔案的內容陣列.
                #$result["lineCount"],爲檔案內容總共的行數.
                #$result["fullContent"],為檔案的完整內容.
                #$result["base64dataOnly"],檔案的base64data.
                #$result["base64data"],為在網頁上給予src參數的數值.
                #$result["mimeType"],為檔案的mime type.
                #必填參數:
                #$conf["filePositionAndName"],字串,爲檔案的位置以及名稱.
                $conf["fileAccesss::getFileContent"]["filePositionAndName"]=$conf["dnsRecordFile"];
                #$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
                $conf["fileAccesss::getFileContent"]["fileArgu"]=__FILE__;
                #可省略參數:
                #$conf["web"],是要取得網路上的檔案則為"true";反之預設為"false".
                $conf["fileAccesss::getFileContent"]["web"]="false";
                #$conf["createIfnotExist"],字串,預設為"false"代表檔案不存在也不需要建立;反之為"true".
                #$conf["createIfnotExist"]="false";
                #$conf["autoDeleteSpaceOnEachLineStart"],字串,預設為"false",不做額外處理;反之為"true"
                #$conf["autoDeleteSpaceOnEachLineStart"]="false";
                #參考資料:
                #file(),取得檔案內容的行數.
                #file=>http:#php.net/manual/en/function.file.php
                #rtrim(),剔除透過file()取得每行內容結尾的換行符號.
                #filesize=>http://php.net/manual/en/function.filesize.php
                #參考資料:
                #無.
                #備註:
                #無.
                $getFileContent=fileAccess::getFileContent($conf["fileAccesss::getFileContent"]);
                unset($conf["fileAccesss::getFileContent"]);
        
                #如果檢查失敗
                if($getFileContent["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$getFileContent;

                        #回傳結果
                        return $result;

                        }#if end
                        
                #取得每行內容
                $lines=$getFileContent["fileContent"];
        
                /*
                範例每行內容:
                $ORIGIN server.domain.  ;base domain-name,in this Resource Records (RR) file,"@" equal to base domain-name.
                $TTL 86400      ;default TTL for zone
                @       1200    IN      SOA     dns.server.domain. admin.server.domain. 2026012205 10800 1800 1728000 1200 ;domain name server, admin mail, serial, refresh time, expire, Negative Caching, https://bind9.readthedocs.io/en/latest/chapter3.html#term-SOA-minimum
                @       3600    IN      TXT     "v=spf1 a mx ~all"
                @       86400   IN      MX      1 mail.server.domain.
                @       86400   IN      A       1.1.1.1
                mail.server.domain.     IN      1.1.1.1
                10-42-0-1       IN      A       10.42.0.1
                101-free        IN      A       101.101.101.101
                127-0-0-1       IN      A       127.0.0.1
                _dmarc  IN      TXT     "v=DMARC1;p=reject;sp=reject;pct=100;adkim=r;aspf=r;fo=1;ri=86400;rua=mailto:admin@server.domain"
                default._domainkey      IN      TXT     ( "v=DKIM1; k=rsa;" "p=MIGfMA0GCSqG/SIb3DQEBAQQAB" )  ; ----- DKIM key default for qbpwcf.org
                ...
                */
                
                #針對每行內容
                foreach($lines as $lineNo => $line){
                
                        #另存一份要處理的RR
                        $unFormatStr=$line;
                
                        #如果要debug
                        if($conf["debug"]==="true"){
                        
                                #函式說明:
                                #撰寫log
                                #回傳結果:
                                #$result["status"],狀態,"true"或"false".
                                #$result["error"],錯誤訊息陣列.
                                #$result["function"],當前函式的名稱.
                                #$result["argu"],使用的參數.
                                #$result["content"],要寫入log的內容字串.
                                #必填參數:
                                #$conf["path"],字串,log檔案的路徑與名稱.
                                $conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
                                #$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
                                $conf["logs::record"]["content"]="processing lineNo:".$lineNo." content:".$line.PHP_EOL;
                                #$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
                                $conf["logs::record"]["fileArgu"]=__FILE__;
                                #可省略參數:
                                #$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
                                #$conf["rewrite"]="false";
                                #$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
                                #$conf["returnOnly"]="true";
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $record=logs::record($conf["logs::record"]);
                                unset($conf["logs::record"]);
                                
                                }#if end
                        
                        #初始化該行的資訊陣列
                        $info=array();
                
                        #尋找";"開頭的內容,亦即整行都是註解.
                        #函式說明:
                        #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                        #回傳結果:
                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                        #$reuslt["error"],執行不正常結束的錯訊息陣列.
                        #$result["function"],當前執行的函式名稱.
                        #$result["argu"],所使用的參數.
                        #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                        #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                        #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
                        #必填參數:
                        #$conf["input"],字串,要檢查的字串.
                        $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                        #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                        $conf["search::findSpecifyStrFormat"]["format"]=";\${else}";
                        #可省略參數:
                        #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                        #$conf["varEqual"]=array(null,"found");
                        #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                        #$conf["varCon"]=array("no_tail"=>" not");
                        #參考資料:
                        #無.
                        #備註:
                        #無.
                        $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                        unset($conf["search::findSpecifyStrFormat"]);
                
                        #如果執行異常
                        if($findSpecifyStrFormat["status"]==="false"){
                        
                                #設置錯誤識別
                                $result["status"]="false";

                                #設置錯誤訊息
                                $result["error"]=$findSpecifyStrFormat;

                                #回傳結果
                                return $result;
                        
                                }#if end
                                
                        #如果有找到符合格式的內容
                        if($findSpecifyStrFormat["found"]==="true"){
                        
                                #儲存為註解
                                $result["comment"][]=$unFormatStr;
                        
                                #換下一行
                                continue;
                        
                                }#if end
                
                        #函式說明:
                        #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                        #回傳結果:
                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                        #$reuslt["error"],執行不正常結束的錯訊息陣列.
                        #$result["function"],當前執行的函式名稱.
                        #$result["argu"],所使用的參數.
                        #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                        #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                        #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
                        #必填參數:
                        #$conf["input"],字串,要檢查的字串.
                        $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                        #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                        $conf["search::findSpecifyStrFormat"]["format"]="\$ORIGIN\${else}";
                        #可省略參數:
                        #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                        #$conf["varEqual"]=array(null,"found");
                        #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                        #$conf["varCon"]=array("no_tail"=>" not");
                        #參考資料:
                        #無.
                        #備註:
                        #無.
                        $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                        unset($conf["search::findSpecifyStrFormat"]);
                
                        #如果執行異常
                        if($findSpecifyStrFormat["status"]==="false"){
                        
                                #設置錯誤識別
                                $result["status"]="false";

                                #設置錯誤訊息
                                $result["error"]=$findSpecifyStrFormat;

                                #回傳結果
                                return $result;
                        
                                }#if end
                                
                        #如果有找到符合格式的內容
                        if($findSpecifyStrFormat["found"]==="true"){
                        
                                #設置 type 的數值
                                $info["type"]="\$ORIGIN";
                        
                                #取得後面待處理的內容
                                $unFormatStr=$findSpecifyStrFormat["parsedVar"]["else"][0];
                        
                                #函式說明:
                                #將字串開頭的特定關鍵字移除.
                                #回傳結果:
                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                #$result["error"],錯誤訊息陣列.
                                #$result["founded"],有無找到開頭要移除的特定字串"true"代表有,"false"代表沒有.
                                #$result["function"],當前執行的函數名稱.
                                #$result["argu"],使用的參數.
                                #$result["content"],處理好的的字串內容.
                                #$result["deleted"],被移除的內容.
                                #必填參數:
                                #$conf["stringIn"],字串,要處理的字串.
                                $conf["stringProcess::delHeadStr"]["stringIn"]=$unFormatStr;
                                #$conf["headStr"],字串陣列,開頭為哪些字串就要移除.
                                $conf["stringProcess::delHeadStr"]["headStr"]=array(" ","\t");
                                #可省略參數:
                                #無.
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $delHeadStr=stringProcess::delHeadStr($conf["stringProcess::delHeadStr"]);
                                unset($conf["stringProcess::delHeadStr"]);
                                        
                                #如果執行異常
                                if($delHeadStr["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$delHeadStr;

                                        #回傳結果
                                        return $result;
                                
                                        }#if end
                                        
                                #如果有移除開頭的字串
                                if($delHeadStr["founded"]==="true"){
                                
                                        #取得處理後的結果
                                        $unFormatStr=$delHeadStr["content"];
                                
                                        }#if end
                        
                                
                        
                                #解析 $ORIGN 的數值, 以及後面是否有註解...
                                #函式說明:
                                #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                                #回傳結果:
                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                #$result["function"],當前執行的函式名稱.
                                #$result["argu"],所使用的參數.
                                #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                                #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                                #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
                                #必填參數:
                                #$conf["input"],字串,要檢查的字串.
                                $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                                #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                                $conf["search::findSpecifyStrFormat"]["format"]="\${value};\${comment}";
                                #可省略參數:
                                #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                                #$conf["varEqual"]=array(null,"found");
                                #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                                #$conf["varCon"]=array("no_tail"=>" not");
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                                unset($conf["search::findSpecifyStrFormat"]);
                        
                                #如果執行異常
                                if($findSpecifyStrFormat["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$findSpecifyStrFormat;

                                        #回傳結果
                                        return $result;
                                
                                        }#if end
                                        
                                #如果有數值跟註解
                                if($findSpecifyStrFormat["found"]==="true"){
                                
                                        #儲存數值
                                        $info["value"]=$findSpecifyStrFormat["parsedVar"]["value"][0];
                                
                                        #儲存zone domain
                                        $result["domain"]=trim($info["value"]);
                                
                                        #儲存註解
                                        $info["comment"]=$findSpecifyStrFormat["parsedVar"]["comment"][0];
                                
                                        #儲存解析好的RR
                                        $result["content"][]=$info;
                                
                                        #換下一行
                                        continue;
                                        
                                        }#if end
                                        
                                #執行到這邊代表剩下的內容都是 value
                                $info["value"]=$unFormatStr;
                                
                                #儲存zone domain
                                $result["domain"]=trim($info["value"]);
                        
                                #儲存解析好的RR
                                $result["content"][]=$info;
                        
                                #換下一行
                                continue;
                        
                                }#if end
                                
                        #檢查是否為 $TTL 開頭
                        #函式說明:
                        #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                        #回傳結果:
                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                        #$reuslt["error"],執行不正常結束的錯訊息陣列.
                        #$result["function"],當前執行的函式名稱.
                        #$result["argu"],所使用的參數.
                        #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                        #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                        #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
                        #必填參數:
                        #$conf["input"],字串,要檢查的字串.
                        $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                        #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                        $conf["search::findSpecifyStrFormat"]["format"]="\$TTL\${else}";
                        #可省略參數:
                        #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                        #$conf["varEqual"]=array(null,"found");
                        #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                        #$conf["varCon"]=array("no_tail"=>" not");
                        #參考資料:
                        #無.
                        #備註:
                        #無.
                        $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                        unset($conf["search::findSpecifyStrFormat"]);
                
                        #如果執行異常
                        if($findSpecifyStrFormat["status"]==="false"){
                        
                                #設置錯誤識別
                                $result["status"]="false";

                                #設置錯誤訊息
                                $result["error"]=$findSpecifyStrFormat;

                                #回傳結果
                                return $result;
                        
                                }#if end
                                
                        #如果有找到符合格式的內容
                        if($findSpecifyStrFormat["found"]==="true"){
                        
                                #設置 type 的數值
                                $info["type"]="\$TTL";
                                
                                #取得後面待處理的內容
                                $unFormatStr=$findSpecifyStrFormat["parsedVar"]["else"][0];
                        
                                #函式說明:
                                #將字串開頭的特定關鍵字移除.
                                #回傳結果:
                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                #$result["error"],錯誤訊息陣列.
                                #$result["founded"],有無找到開頭要移除的特定字串"true"代表有,"false"代表沒有.
                                #$result["function"],當前執行的函數名稱.
                                #$result["argu"],使用的參數.
                                #$result["content"],處理好的的字串內容.
                                #$result["deleted"],被移除的內容.
                                #必填參數:
                                #$conf["stringIn"],字串,要處理的字串.
                                $conf["stringProcess::delHeadStr"]["stringIn"]=$unFormatStr;
                                #$conf["headStr"],字串陣列,開頭為哪些字串就要移除.
                                $conf["stringProcess::delHeadStr"]["headStr"]=array(" ","\t");
                                #可省略參數:
                                #無.
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $delHeadStr=stringProcess::delHeadStr($conf["stringProcess::delHeadStr"]);
                                unset($conf["stringProcess::delHeadStr"]);
                                        
                                #如果執行異常
                                if($delHeadStr["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$delHeadStr;

                                        #回傳結果
                                        return $result;
                                
                                        }#if end
                                        
                                #如果有移除開頭的字串
                                if($delHeadStr["founded"]==="true"){
                                
                                        #取得處理後的結果
                                        $unFormatStr=$delHeadStr["content"];
                                
                                        }#if end
                                
                                #解析 $TTL 的數值, 以及後面是否有註解...
                                #函式說明:
                                #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                                #回傳結果:
                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                #$result["function"],當前執行的函式名稱.
                                #$result["argu"],所使用的參數.
                                #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                                #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                                #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
                                #必填參數:
                                #$conf["input"],字串,要檢查的字串.
                                $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                                #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                                $conf["search::findSpecifyStrFormat"]["format"]="\${value};\${comment}";
                                #可省略參數:
                                #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                                #$conf["varEqual"]=array(null,"found");
                                #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                                #$conf["varCon"]=array("no_tail"=>" not");
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                                unset($conf["search::findSpecifyStrFormat"]);
                        
                                #如果執行異常
                                if($findSpecifyStrFormat["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$findSpecifyStrFormat;

                                        #回傳結果
                                        return $result;
                                
                                        }#if end
                                        
                                #如果有數值跟註解
                                if($findSpecifyStrFormat["found"]==="true"){
                                
                                        #儲存數值
                                        $info["value"]=$findSpecifyStrFormat["parsedVar"]["value"][0];
                                
                                        #儲存註解
                                        $info["comment"]=$findSpecifyStrFormat["parsedVar"]["comment"][0];
                                
                                        #儲存預設的 TTL
                                        $result["defaultTTL"]=trim($info["value"]);
                                
                                        #儲存解析好的RR
                                        $result["content"][]=$info;
                                
                                        #換下一行
                                        continue;
                                        
                                        }#if end
                                        
                                #執行到這邊代表剩下的內容都是 value
                                $info["value"]=$unFormatStr;
                                
                                #儲存預設的 TTL
                                $result["defaultTTL"]=trim($info["value"]);
                                
                                #儲存解析好的RR
                                $result["content"][]=$info;
                                
                                #換下一行
                                continue;
                        
                                }#if end
                        
                        #如果 內容為 query updatTime IN type value;comment,或value含有(或",則需要將其符號與後面的內容先暫時拆開
                        
                        #函式說明:
                        #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                        #回傳結果:
                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                        #$reuslt["error"],執行不正常結束的錯訊息陣列.
                        #$result["function"],當前執行的函式名稱.
                        #$result["argu"],所使用的參數.
                        #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                        #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                        #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容,變數的key從0開始.
                        #必填參數:
                        #$conf["input"],字串,要檢查的字串.
                        $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                        #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                        $conf["search::findSpecifyStrFormat"]["format"]="\${left}(\${right}";
                        #可省略參數:
                        #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                        #$conf["varEqual"]=array(null,"found");
                        #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                        #$conf["varCon"]=array("no_tail"=>" not");
                        #參考資料:
                        #無.
                        #備註:
                        #無.
                        $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                        unset($conf["search::findSpecifyStrFormat"]);
                
                        #如果執行異常
                        if($findSpecifyStrFormat["status"]==="false"){
                        
                                #設置錯誤識別
                                $result["status"]="false";

                                #設置錯誤訊息
                                $result["error"]=$findSpecifyStrFormat;

                                #回傳結果
                                return $result;
                
                                }#if end
                                
                        #如果存在"("
                        if($findSpecifyStrFormat["found"]==="true"){
                        
                                #取得無"("的內容
                                $unFormatStr=$findSpecifyStrFormat["parsedVar"]["left"][0];
                                
                                #取得拆下來的含開頭"("內容
                                $unFormatStr2add="(".$findSpecifyStrFormat["parsedVar"]["right"][0];
                                
                                }#if end
                        
                        #反之
                        else{
                        
                                #函式說明:
                                #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                                #回傳結果:
                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                #$result["function"],當前執行的函式名稱.
                                #$result["argu"],所使用的參數.
                                #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                                #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                                #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容,變數的key從0開始.
                                #必填參數:
                                #$conf["input"],字串,要檢查的字串.
                                $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                                #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                                $conf["search::findSpecifyStrFormat"]["format"]="\${left}\"\${right}";
                                #可省略參數:
                                #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                                #$conf["varEqual"]=array(null,"found");
                                #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                                #$conf["varCon"]=array("no_tail"=>" not");
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                                unset($conf["search::findSpecifyStrFormat"]);
                        
                                #如果執行異常
                                if($findSpecifyStrFormat["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$findSpecifyStrFormat;

                                        #回傳結果
                                        return $result;
                        
                                        }#if end
                                        
                                #如果存在"
                                if($findSpecifyStrFormat["found"]==="true"){
                                
                                        #取得無"的內容
                                        $unFormatStr=$findSpecifyStrFormat["parsedVar"]["left"][0];
                                        
                                        #取得拆下來的含開頭"內容
                                        $unFormatStr2add="\"".$findSpecifyStrFormat["parsedVar"]["right"][0];
                                        
                                        }#if end
                                        
                                #反之
                                else{
                                
                                        #函式說明:
                                        #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                                        #回傳結果:
                                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                        #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                        #$result["function"],當前執行的函式名稱.
                                        #$result["argu"],所使用的參數.
                                        #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                                        #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                                        #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容,變數的key從0開始.
                                        #必填參數:
                                        #$conf["input"],字串,要檢查的字串.
                                        $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                                        #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                                        $conf["search::findSpecifyStrFormat"]["format"]="\${left};\${right}";
                                        #可省略參數:
                                        #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                                        #$conf["varEqual"]=array(null,"found");
                                        #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                                        #$conf["varCon"]=array("no_tail"=>" not");
                                        #參考資料:
                                        #無.
                                        #備註:
                                        #無.
                                        $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                                        unset($conf["search::findSpecifyStrFormat"]);
                                
                                        #如果執行異常
                                        if($findSpecifyStrFormat["status"]==="false"){
                                        
                                                #設置錯誤識別
                                                $result["status"]="false";

                                                #設置錯誤訊息
                                                $result["error"]=$findSpecifyStrFormat;

                                                #回傳結果
                                                return $result;
                                
                                                }#if end
                                                
                                        #如果存在";"
                                        if($findSpecifyStrFormat["found"]==="true"){
                                        
                                                #取得無";"的內容
                                                $unFormatStr=$findSpecifyStrFormat["parsedVar"]["left"][0];
                                                
                                                #取得拆下來的含開頭";"內容
                                                $unFormatStr2add=";".$findSpecifyStrFormat["parsedVar"]["right"][0];
                                                
                                                }#if end
                                
                                        }#else end
                        
                                }#else end
                        
                        #檢查是否為 @ 開頭
                        #函式說明:
                        #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                        #回傳結果:
                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                        #$reuslt["error"],執行不正常結束的錯訊息陣列.
                        #$result["function"],當前執行的函式名稱.
                        #$result["argu"],所使用的參數.
                        #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                        #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                        #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
                        #必填參數:
                        #$conf["input"],字串,要檢查的字串.
                        $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                        #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                        $conf["search::findSpecifyStrFormat"]["format"]="@\${else}";
                        #可省略參數:
                        #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                        #$conf["varEqual"]=array(null,"found");
                        #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                        #$conf["varCon"]=array("no_tail"=>" not");
                        #參考資料:
                        #無.
                        #備註:
                        #無.
                        $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                        unset($conf["search::findSpecifyStrFormat"]);
                
                        #如果執行異常
                        if($findSpecifyStrFormat["status"]==="false"){
                        
                                #設置錯誤識別
                                $result["status"]="false";

                                #設置錯誤訊息
                                $result["error"]=$findSpecifyStrFormat;

                                #回傳結果
                                return $result;
                        
                                }#if end
                                
                        #如果有找到符合格式的內容
                        if($findSpecifyStrFormat["found"]==="true"){
                        
                                #設置 query 的數值
                                $info["query"]="@";
                                
                                #取得後面待處理的內容
                                $unFormatStr=$findSpecifyStrFormat["parsedVar"]["else"][0];
                                
                                #函式說明:
                                #將字串開頭的特定關鍵字移除.
                                #回傳結果:
                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                #$result["error"],錯誤訊息陣列.
                                #$result["founded"],有無找到開頭要移除的特定字串"true"代表有,"false"代表沒有.
                                #$result["function"],當前執行的函數名稱.
                                #$result["argu"],使用的參數.
                                #$result["content"],處理好的的字串內容.
                                #$result["deleted"],被移除的內容.
                                #必填參數:
                                #$conf["stringIn"],字串,要處理的字串.
                                $conf["stringProcess::delHeadStr"]["stringIn"]=$unFormatStr;
                                #$conf["headStr"],字串陣列,開頭為哪些字串就要移除.
                                $conf["stringProcess::delHeadStr"]["headStr"]=array(" ","\t");
                                #可省略參數:
                                #無.
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $delHeadStr=stringProcess::delHeadStr($conf["stringProcess::delHeadStr"]);
                                unset($conf["stringProcess::delHeadStr"]);
                                
                                #如果執行異常
                                if($delHeadStr["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$delHeadStr;

                                        #回傳結果
                                        return $result;
                                
                                        }#if end
                                        
                                #如果有移除開頭的字串
                                if($delHeadStr["founded"]==="true"){
                                
                                        #取得處理後的結果 update time..IN..type...value;comment
                                        $unFormatStr=$delHeadStr["content"];
                                
                                        }#if end
                                        
                                #debug
                                #var_dump(__LINE__,$delHeadStr);
                                
                                }#if end
                        
                        #反之
                        else{
                                
                                #執行到這邊,代表 query 為一非 @ 的字串
                                #函式說明:
                                #將指令字串解析成陣列,方便給予 external::callShell 使用
                                #回傳結果:
                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                #$result["function"],當前執行的函式名稱.
                                #$result["content"],解析好的指令陣列.
                                #$result["cmd"],解析好的指令名稱.
                                #$result["argus"],解析好的參數陣列.
                                #$result["argu"],所使用的參數.
                                #必填參數
                                #$conf["cmdStr"],字串,要解析的指令字串
                                $conf["stringProcess::parseCmdString"]["cmdStr"]=$unFormatStr;
                                #可省略參數:
                                #無.
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $parseCmdString=cmd::parseCmdString($conf["stringProcess::parseCmdString"]);
                                unset($conf["stringProcess::parseCmdString"]);
                                
                                #如果執行失敗
                                if($parseCmdString["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$parseCmdString;
                                        
                                        #debug
                                        #$result["errorProcessLine"]=$line;

                                        #回傳結果
                                        return $result;
                                
                                        }#if end
                                        
                                #取得 query 的內容
                                $info["query"]=$parseCmdString["content"][0];
                                
                                #剔除 query以及後面的" "跟\t
                                #函式說明:
                                #將字串開頭的特定關鍵字移除.
                                #回傳結果:
                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                #$result["error"],錯誤訊息陣列.
                                #$result["founded"],有無找到開頭要移除的特定字串"true"代表有,"false"代表沒有.
                                #$result["function"],當前執行的函數名稱.
                                #$result["argu"],使用的參數.
                                #$result["content"],處理好的的字串內容.
                                #$result["deleted"],被移除的內容.
                                #必填參數:
                                #$conf["stringIn"],字串,要處理的字串.
                                $conf["stringProcess::delHeadStr"]["stringIn"]=$unFormatStr;
                                #$conf["headStr"],字串陣列,開頭為哪些字串就要移除.
                                $conf["stringProcess::delHeadStr"]["headStr"]=array($info["query"]," ","\t");
                                #可省略參數:
                                #無.
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $delHeadStr=stringProcess::delHeadStr($conf["stringProcess::delHeadStr"]);
                                unset($conf["stringProcess::delHeadStr"]);
                                
                                #如果執行異常
                                if($delHeadStr["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$delHeadStr;

                                        #回傳結果
                                        return $result;
                                
                                        }#if end
                                        
                                #取得update time..IN..type...value;comment
                                $unFormatStr=$delHeadStr["content"];
                        
                                }#else end
                        
                        #無窮迴圈
                        while(true){
                                
                                #如果要debug
                                if($conf["debug"]==="true"){
                                
                                        #函式說明:
                                        #撰寫log
                                        #回傳結果:
                                        #$result["status"],狀態,"true"或"false".
                                        #$result["error"],錯誤訊息陣列.
                                        #$result["function"],當前函式的名稱.
                                        #$result["argu"],使用的參數.
                                        #$result["content"],要寫入log的內容字串.
                                        #必填參數:
                                        #$conf["path"],字串,log檔案的路徑與名稱.
                                        $conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
                                        #$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
                                        $conf["logs::record"]["content"]="lineNo:".__LINE__." \$unFormatStr:".$unFormatStr.PHP_EOL;
                                        #$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
                                        $conf["logs::record"]["fileArgu"]=__FILE__;
                                        #可省略參數:
                                        #$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
                                        #$conf["rewrite"]="false";
                                        #$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
                                        #$conf["returnOnly"]="true";
                                        #參考資料:
                                        #無.
                                        #備註:
                                        #無.
                                        $record=logs::record($conf["logs::record"]);
                                        unset($conf["logs::record"]);
                                        
                                        }#if end
                                
                                #解析 updateTime..IN..type...value...comment
                        
                                #判斷是否無 update time
                                
                                #函式說明:
                                #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                                #回傳結果:
                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                #$result["function"],當前執行的函式名稱.
                                #$result["argu"],所使用的參數.
                                #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                                #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                                #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
                                #必填參數:
                                #$conf["input"],字串,要檢查的字串.
                                $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                                #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                                $conf["search::findSpecifyStrFormat"]["format"]="IN\${else}";
                                #可省略參數:
                                #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                                #$conf["varEqual"]=array(null,"found");
                                #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                                #$conf["varCon"]=array("no_tail"=>" not");
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                                unset($conf["search::findSpecifyStrFormat"]);
                        
                                #如果執行異常
                                if($findSpecifyStrFormat["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$findSpecifyStrFormat;

                                        #回傳結果
                                        return $result;
                                
                                        }#if end
                                        
                                #如果有找到符合格式的內容
                                if($findSpecifyStrFormat["found"]==="true"){
                                
                                        #代表沒有 update time 欄位,因此儲存預設的TTL
                                        $info["update"]=&$result["defaultTTL"];
                                        
                                        #取得剩下的 ...type...value;comment
                                        $unFormatStr=$findSpecifyStrFormat["parsedVar"]["else"][0];
                                        
                                        #設置該行沒有指定 update time
                                        $noUpdateTime="true";
                                        
                                        #如果要debug
                                        if($conf["debug"]==="true"){
                                        
                                                #函式說明:
                                                #撰寫log
                                                #回傳結果:
                                                #$result["status"],狀態,"true"或"false".
                                                #$result["error"],錯誤訊息陣列.
                                                #$result["function"],當前函式的名稱.
                                                #$result["argu"],使用的參數.
                                                #$result["content"],要寫入log的內容字串.
                                                #必填參數:
                                                #$conf["path"],字串,log檔案的路徑與名稱.
                                                $conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
                                                #$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
                                                $conf["logs::record"]["content"]="lineNo:".__LINE__." \$unFormatStr:".$unFormatStr.PHP_EOL;
                                                #$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
                                                $conf["logs::record"]["fileArgu"]=__FILE__;
                                                #可省略參數:
                                                #$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
                                                #$conf["rewrite"]="false";
                                                #$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
                                                #$conf["returnOnly"]="true";
                                                #參考資料:
                                                #無.
                                                #備註:
                                                #無.
                                                $record=logs::record($conf["logs::record"]);
                                                unset($conf["logs::record"]);
                                        
                                                }#if end
                                
                                        }#if end
                                        
                                #反之
                                else{
                                
                                        #設置該行有指定 update time
                                        $noUpdateTime="false";
                                
                                        #如果有指定 update time
                                        if($noUpdateTime==="false"){
                                        
                                                #要來解析 update time
                                                #函式說明:
                                                #將字串進行解析,變成多個參數.
                                                #回傳結果:
                                                #$result["status"],執行正常與否,"false"代表不正常,"true"代表正常.
                                                #$result["function"],當前執行的函式內容.
                                                #$result["error"],錯誤訊息陣列.
                                                #$result["content"],參數陣列.
                                                #$result["count"],總共有幾個參數.
                                                #必填參數:
                                                #$conf["input"],字串,要解析成參數的字串.
                                                $conf["stringProcess::parse"]["input"]=$unFormatStr;
                                                #可省略參數:
                                                #無.
                                                #參考資料:
                                                #無.
                                                #備註:
                                                #無.
                                                $parse=stringProcess::parse($conf["stringProcess::parse"]);
                                                unset($conf["stringProcess::parse"]);
                                                
                                                #如果執行異常
                                                if($parse["status"]==="false"){
                                                
                                                        #設置錯誤識別
                                                        $result["status"]="false";

                                                        #設置錯誤訊息
                                                        $result["error"]=$parse;

                                                        #回傳結果
                                                        return $result;
                                                        
                                                        }#if end
                                                        
                                                #取得更新時間
                                                $info["update"]=$parse["content"][0];
                                        
                                                #取得 update time 後面的內容
                                                #函式說明:
                                                #將字串開頭的特定關鍵字移除.
                                                #回傳結果:
                                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                                #$result["error"],錯誤訊息陣列.
                                                #$result["founded"],有無找到開頭要移除的特定字串"true"代表有,"false"代表沒有.
                                                #$result["function"],當前執行的函數名稱.
                                                #$result["argu"],使用的參數.
                                                #$result["content"],處理好的的字串內容.
                                                #$result["deleted"],被移除的內容.
                                                #必填參數:
                                                #$conf["stringIn"],字串,要處理的字串.
                                                $conf["stringProcess::delHeadStr"]["stringIn"]=$unFormatStr;
                                                #$conf["headStr"],字串陣列,開頭為哪些字串就要移除.
                                                $conf["stringProcess::delHeadStr"]["headStr"]=array($info["update"]);
                                                #可省略參數:
                                                #無.
                                                #參考資料:
                                                #無.
                                                #備註:
                                                #無.
                                                $delHeadStr=stringProcess::delHeadStr($conf["stringProcess::delHeadStr"]);
                                                unset($conf["stringProcess::delHeadStr"]);
                                                
                                                #如果執行異常
                                                if($delHeadStr["status"]==="false"){
                                                
                                                        #設置錯誤識別
                                                        $result["status"]="false";

                                                        #設置錯誤訊息
                                                        $result["error"]=$delHeadStr;

                                                        #回傳結果
                                                        return $result;
                                                
                                                        }#if end
                                                
                                                #取得...IN...value;comment
                                                $unFormatStr=$delHeadStr["content"];
                                        
                                                }#if end
                                        
                                        #取得 ...IN... 後面的內容
                                        #函式說明:
                                        #將字串開頭的特定關鍵字移除.
                                        #回傳結果:
                                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                        #$result["error"],錯誤訊息陣列.
                                        #$result["founded"],有無找到開頭要移除的特定字串"true"代表有,"false"代表沒有.
                                        #$result["function"],當前執行的函數名稱.
                                        #$result["argu"],使用的參數.
                                        #$result["content"],處理好的的字串內容.
                                        #$result["deleted"],被移除的內容.
                                        #必填參數:
                                        #$conf["stringIn"],字串,要處理的字串.
                                        $conf["stringProcess::delHeadStr"]["stringIn"]=$unFormatStr;
                                        #$conf["headStr"],字串陣列,開頭為哪些字串就要移除.
                                        $conf["stringProcess::delHeadStr"]["headStr"]=array(" ","\t","IN");
                                        #可省略參數:
                                        #無.
                                        #參考資料:
                                        #無.
                                        #備註:
                                        #無.
                                        $delHeadStr=stringProcess::delHeadStr($conf["stringProcess::delHeadStr"]);
                                        unset($conf["stringProcess::delHeadStr"]);
                                        
                                        #如果執行異常
                                        if($delHeadStr["status"]==="false"){
                                        
                                                #設置錯誤識別
                                                $result["status"]="false";

                                                #設置錯誤訊息
                                                $result["error"]=$delHeadStr;

                                                #回傳結果
                                                return $result;
                                        
                                                }#if end
                                        
                                        #取得IN...value;comment
                                        $unFormatStr=$delHeadStr["content"];
                                        
                                        #如果要debug
                                        if($conf["debug"]==="true"){
                                        
                                                #函式說明:
                                                #撰寫log
                                                #回傳結果:
                                                #$result["status"],狀態,"true"或"false".
                                                #$result["error"],錯誤訊息陣列.
                                                #$result["function"],當前函式的名稱.
                                                #$result["argu"],使用的參數.
                                                #$result["content"],要寫入log的內容字串.
                                                #必填參數:
                                                #$conf["path"],字串,log檔案的路徑與名稱.
                                                $conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
                                                #$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
                                                $conf["logs::record"]["content"]="lineNo:".__LINE__." \$unFormatStr:".$unFormatStr.PHP_EOL;
                                                #$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
                                                $conf["logs::record"]["fileArgu"]=__FILE__;
                                                #可省略參數:
                                                #$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
                                                #$conf["rewrite"]="false";
                                                #$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
                                                #$conf["returnOnly"]="true";
                                                #參考資料:
                                                #無.
                                                #備註:
                                                #無.
                                                $record=logs::record($conf["logs::record"]);
                                                unset($conf["logs::record"]);
                                        
                                                }#if end
                                        
                                        }#else end
                                
                                #解析 type...value;comment
                                #函式說明:
                                #將字串進行解析,變成多個參數.
                                #回傳結果:
                                #$result["status"],執行正常與否,"false"代表不正常,"true"代表正常.
                                #$result["function"],當前執行的函式內容.
                                #$result["error"],錯誤訊息陣列.
                                #$result["content"],參數陣列.
                                #$result["count"],總共有幾個參數.
                                #必填參數:
                                #$conf["input"],字串,要解析成參數的字串.
                                $conf["stringProcess::parse"]["input"]=$unFormatStr;
                                #可省略參數:
                                #無.
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $parse=stringProcess::parse($conf["stringProcess::parse"]);
                                unset($conf["stringProcess::parse"]);
                                
                                #如果執行異常
                                if($parse["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$parse;

                                        #回傳結果
                                        return $result;
                                        
                                        }#if end
                                
                                #取得 type
                                $info["type"]=$parse["content"][0];
                                
                                #取得 type...後面的value;comment內容
                                #函式說明:
                                #將字串開頭的特定關鍵字移除.
                                #回傳結果:
                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                #$result["error"],錯誤訊息陣列.
                                #$result["founded"],有無找到開頭要移除的特定字串"true"代表有,"false"代表沒有.
                                #$result["function"],當前執行的函數名稱.
                                #$result["argu"],使用的參數.
                                #$result["content"],處理好的的字串內容.
                                #$result["deleted"],被移除的內容.
                                #必填參數:
                                #$conf["stringIn"],字串,要處理的字串.
                                $conf["stringProcess::delHeadStr"]["stringIn"]=$unFormatStr;
                                #$conf["headStr"],字串陣列,開頭為哪些字串就要移除.
                                $conf["stringProcess::delHeadStr"]["headStr"]=array($info["type"]," ","\t");
                                #可省略參數:
                                #無.
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $delHeadStr=stringProcess::delHeadStr($conf["stringProcess::delHeadStr"]);
                                unset($conf["stringProcess::delHeadStr"]);
                                
                                #如果執行異常
                                if($delHeadStr["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$delHeadStr;

                                        #回傳結果
                                        return $result;
                                
                                        }#if end
                                        
                                #取得 value;comment
                                $unFormatStr=$delHeadStr["content"];
                                
                                #如果有要合併回去的內容
                                if(isset($unFormatStr2add)){
                                
                                        #合併回去內容
                                        $unFormatStr=$unFormatStr.$unFormatStr2add;
                                
                                        #移除用不到的變數
                                        unset($unFormatStr2add);
                                
                                        }#if end
                                
                                #如果要debug
                                if($conf["debug"]==="true"){
                                
                                        #函式說明:
                                        #撰寫log
                                        #回傳結果:
                                        #$result["status"],狀態,"true"或"false".
                                        #$result["error"],錯誤訊息陣列.
                                        #$result["function"],當前函式的名稱.
                                        #$result["argu"],使用的參數.
                                        #$result["content"],要寫入log的內容字串.
                                        #必填參數:
                                        #$conf["path"],字串,log檔案的路徑與名稱.
                                        $conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
                                        #$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
                                        $conf["logs::record"]["content"]="lineNo:".__LINE__." \$unFormatStr:".$unFormatStr.PHP_EOL;
                                        #$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
                                        $conf["logs::record"]["fileArgu"]=__FILE__;
                                        #可省略參數:
                                        #$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
                                        #$conf["rewrite"]="false";
                                        #$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
                                        #$conf["returnOnly"]="true";
                                        #參考資料:
                                        #無.
                                        #備註:
                                        #無.
                                        $record=logs::record($conf["logs::record"]);
                                        unset($conf["logs::record"]);
                                
                                        }#if end
                                
                                #如果type不為 CNAME 跟 TXT 跟 SOA
                                if( $info["type"]!=="CNAME" && $info["type"]!=="TXT" && $info["type"]!=="SOA" ){
                                
                                        #儲存value
                                        $info["value"]=$unFormatStr;
                                
                                        #判斷是否有 ";" 存在
                                        #函式說明:
                                        #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                                        #回傳結果:
                                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                        #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                        #$result["function"],當前執行的函式名稱.
                                        #$result["argu"],所使用的參數.
                                        #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                                        #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                                        #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
                                        #必填參數:
                                        #$conf["input"],字串,要檢查的字串.
                                        $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                                        #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                                        $conf["search::findSpecifyStrFormat"]["format"]="\${value};\${comment}";
                                        #可省略參數:
                                        #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                                        #$conf["varEqual"]=array(null,"found");
                                        #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                                        #$conf["varCon"]=array("no_tail"=>" not");
                                        #參考資料:
                                        #無.
                                        #備註:
                                        #無.
                                        $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                                        unset($conf["search::findSpecifyStrFormat"]);
                                
                                        #如果執行異常
                                        if($findSpecifyStrFormat["status"]==="false"){
                                        
                                                #設置錯誤識別
                                                $result["status"]="false";

                                                #設置錯誤訊息
                                                $result["error"]=$findSpecifyStrFormat;

                                                #回傳結果
                                                return $result;
                                        
                                                }#if end
                                                
                                        #如果有 ";"
                                        if($findSpecifyStrFormat["found"]==="true"){
                                        
                                                #儲存value
                                                $info["value"]=$findSpecifyStrFormat["parsedVar"]["value"][0];
                                        
                                                #儲存comment
                                                $info["comment"]=$findSpecifyStrFormat["parsedVar"]["comment"][0];
                                        
                                                }#if end
                                                
                                        #儲存該筆RR
                                        $result["content"][]=$info;
                                                
                                        #解析完畢換下一行
                                        continue 2;
                                
                                        }#if end
                                                
                                #執行到這邊,代表type為CNAME或TXT或SOA
                                
                                #如果 type 是 SOA
                                if($info["type"]==="SOA"){
                                
                                        #如果要debug
                                        if($conf["debug"]==="true"){
                                        
                                                #函式說明:
                                                #撰寫log
                                                #回傳結果:
                                                #$result["status"],狀態,"true"或"false".
                                                #$result["error"],錯誤訊息陣列.
                                                #$result["function"],當前函式的名稱.
                                                #$result["argu"],使用的參數.
                                                #$result["content"],要寫入log的內容字串.
                                                #必填參數:
                                                #$conf["path"],字串,log檔案的路徑與名稱.
                                                $conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
                                                #$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
                                                $conf["logs::record"]["content"]="lineNo:".__LINE__." type:".$info["type"].PHP_EOL;
                                                #$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
                                                $conf["logs::record"]["fileArgu"]=__FILE__;
                                                #可省略參數:
                                                #$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
                                                #$conf["rewrite"]="false";
                                                #$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
                                                #$conf["returnOnly"]="true";
                                                #參考資料:
                                                #無.
                                                #備註:
                                                #無.
                                                $record=logs::record($conf["logs::record"]);
                                                unset($conf["logs::record"]);
                                        
                                                }#if end
                                                
                                        #SOA 範例
                                        #@      1200    IN      SOA     dns.qbpwcf.org. liveuser.qbpwcf.org. 2026012205 10800 1800 1728000 1200 ;domain name server, admin mail, serial, refresh time, expire, Negative Caching, https://bind9.readthedocs.io/en/latest/chapter3.html#term-SOA-minimum
                                
                                        #再度嘗試分割
                                        #如果 內容為 query updatTime IN type value;comment,或value含有(或",則需要將其符號與後面的內容先暫時拆開
                        
                                        #函式說明:
                                        #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                                        #回傳結果:
                                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                        #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                        #$result["function"],當前執行的函式名稱.
                                        #$result["argu"],所使用的參數.
                                        #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                                        #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                                        #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容,變數的key從0開始.
                                        #必填參數:
                                        #$conf["input"],字串,要檢查的字串.
                                        $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                                        #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                                        $conf["search::findSpecifyStrFormat"]["format"]="\${left}(\${right}";
                                        #可省略參數:
                                        #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                                        #$conf["varEqual"]=array(null,"found");
                                        #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                                        #$conf["varCon"]=array("no_tail"=>" not");
                                        #參考資料:
                                        #無.
                                        #備註:
                                        #無.
                                        $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                                        unset($conf["search::findSpecifyStrFormat"]);
                                
                                        #如果執行異常
                                        if($findSpecifyStrFormat["status"]==="false"){
                                        
                                                #設置錯誤識別
                                                $result["status"]="false";

                                                #設置錯誤訊息
                                                $result["error"]=$findSpecifyStrFormat;

                                                #回傳結果
                                                return $result;
                                
                                                }#if end
                                                
                                        #如果存在"("
                                        if($findSpecifyStrFormat["found"]==="true"){
                                        
                                                #取得無"("的內容
                                                $unFormatStr=$findSpecifyStrFormat["parsedVar"]["left"][0];
                                                
                                                #取得拆下來的含開頭"("內容
                                                $unFormatStr2add="(".$findSpecifyStrFormat["parsedVar"]["right"][0];
                                                
                                                }#if end
                                        
                                        #反之
                                        else{
                                        
                                                #函式說明:
                                                #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                                                #回傳結果:
                                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                                #$result["function"],當前執行的函式名稱.
                                                #$result["argu"],所使用的參數.
                                                #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                                                #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                                                #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容,變數的key從0開始.
                                                #必填參數:
                                                #$conf["input"],字串,要檢查的字串.
                                                $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                                                #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                                                $conf["search::findSpecifyStrFormat"]["format"]="\${left}\"\${right}";
                                                #可省略參數:
                                                #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                                                #$conf["varEqual"]=array(null,"found");
                                                #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                                                #$conf["varCon"]=array("no_tail"=>" not");
                                                #參考資料:
                                                #無.
                                                #備註:
                                                #無.
                                                $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                                                unset($conf["search::findSpecifyStrFormat"]);
                                        
                                                #如果執行異常
                                                if($findSpecifyStrFormat["status"]==="false"){
                                                
                                                        #設置錯誤識別
                                                        $result["status"]="false";

                                                        #設置錯誤訊息
                                                        $result["error"]=$findSpecifyStrFormat;

                                                        #回傳結果
                                                        return $result;
                                        
                                                        }#if end
                                                        
                                                #如果存在"
                                                if($findSpecifyStrFormat["found"]==="true"){
                                                
                                                        #取得無"的內容
                                                        $unFormatStr=$findSpecifyStrFormat["parsedVar"]["left"][0];
                                                        
                                                        #取得拆下來的含開頭"內容
                                                        $unFormatStr2add="\"".$findSpecifyStrFormat["parsedVar"]["right"][0];
                                                        
                                                        }#if end
                                                        
                                                #反之
                                                else{
                                                
                                                        #函式說明:
                                                        #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                                                        #回傳結果:
                                                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                                        #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                                        #$result["function"],當前執行的函式名稱.
                                                        #$result["argu"],所使用的參數.
                                                        #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                                                        #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                                                        #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容,變數的key從0開始.
                                                        #必填參數:
                                                        #$conf["input"],字串,要檢查的字串.
                                                        $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                                                        #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                                                        $conf["search::findSpecifyStrFormat"]["format"]="\${left};\${right}";
                                                        #可省略參數:
                                                        #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                                                        #$conf["varEqual"]=array(null,"found");
                                                        #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                                                        #$conf["varCon"]=array("no_tail"=>" not");
                                                        #參考資料:
                                                        #無.
                                                        #備註:
                                                        #無.
                                                        $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                                                        unset($conf["search::findSpecifyStrFormat"]);
                                                
                                                        #如果執行異常
                                                        if($findSpecifyStrFormat["status"]==="false"){
                                                        
                                                                #設置錯誤識別
                                                                $result["status"]="false";

                                                                #設置錯誤訊息
                                                                $result["error"]=$findSpecifyStrFormat;

                                                                #回傳結果
                                                                return $result;
                                                
                                                                }#if end
                                                                
                                                        #如果存在";"
                                                        if($findSpecifyStrFormat["found"]==="true"){
                                                        
                                                                #取得無";"的內容
                                                                $unFormatStr=$findSpecifyStrFormat["parsedVar"]["left"][0];
                                                                
                                                                #取得拆下來的含開頭";"內容
                                                                $unFormatStr2add=";".$findSpecifyStrFormat["parsedVar"]["right"][0];
                                                                
                                                                }#if end
                                                
                                                        }#else end
                                        
                                                }#else end
                                
                                        #取得 serial number
                                        #函式說明:
                                        #將字串進行解析,變成多個參數.
                                        #回傳結果:
                                        #$result["status"],執行正常與否,"false"代表不正常,"true"代表正常.
                                        #$result["function"],當前執行的函式內容.
                                        #$result["error"],錯誤訊息陣列.
                                        #$result["content"],參數陣列.
                                        #$result["count"],總共有幾個參數.
                                        #必填參數:
                                        #$conf["input"],字串,要解析成參數的字串.
                                        $conf["stringProcess::parse"]["input"]=$unFormatStr;
                                        #可省略參數:
                                        #無.
                                        #參考資料:
                                        #無.
                                        #備註:
                                        #無.
                                        $parse=stringProcess::parse($conf["stringProcess::parse"]);
                                        unset($conf["stringProcess::parse"]);
                                        
                                        #如果執行異常
                                        if($parse["status"]==="false"){
                                        
                                                #設置錯誤識別
                                                $result["status"]="false";

                                                #設置錯誤訊息
                                                $result["error"]=$parse;

                                                #回傳結果
                                                return $result;
                                        
                                                }#if end
                                        
                                        #取得serial number
                                        $serialNo=$parse["content"][2];
                                
                                        #serialNo+1
                                        $serialNo++;
                                
                                        #回存
                                        $parse["content"][2]=(string)$serialNo;
                                        
                                        #函式說明:
                                        #將一維陣列轉換為用特定符號間隔的字串,ex:array("1","2","3") to "a;b;c;".
                                        #回傳的結果:
                                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                        #$result["function"],當前執行的function名稱
                                        #$result["error"],錯誤訊息陣列.
                                        #$result["content"],處理好的字串.
                                        #$result["argu"],使用的參數.
                                        #必填參數:
                                        #$conf["inputArray"],字串陣列,要轉成字串的一維陣列.
                                        $conf["arrays::arrayToString"]["inputArray"]=$parse["content"];
                                        #可省略參數:
                                        #$conf["spiltSymbol"],字串,用來區隔字串的符號,預設為;
                                        $conf["arrays::arrayToString"]["spiltSymbol"]=" ";
                                        #$conf["skipEnd"],字串,結尾是否不要加上符號,預設為"false",要加上符號,"true"代表不要加上符號。
                                        $conf["arrays::arrayToString"]["skipEnd"]="true";
                                        #$conf["spiltSymbolAtStart"],字串,是否要在開頭加上spiltSymbol,預設為"false",代表不要;反之為“true”.
                                        #$conf["spiltSymbolAtStart"]="";
                                        #參考資料:
                                        #無.
                                        #備註:
                                        #無.
                                        $arrayToString=arrays::arrayToString($conf["arrays::arrayToString"]);
                                        unset($conf["arrays::arrayToString"]);
                                        
                                        #如果執行異常
                                        if($arrayToString["status"]==="false"){
                                        
                                                #設置錯誤識別
                                                $result["status"]="false";

                                                #設置錯誤訊息
                                                $result["error"]=$arrayToString;

                                                #回傳結果
                                                return $result;
                                        
                                                }#if end
                                        
                                        #取得更新 serial number 後的 SOA value string
                                        $unFormatStr=$arrayToString["content"];
                                
                                        #如果有要合併回去的內容
                                        if(isset($unFormatStr2add)){
                                        
                                                #合併回去內容
                                                $unFormatStr=$unFormatStr.$unFormatStr2add;
                                        
                                                #移除用不到的變數
                                                unset($unFormatStr2add);
                                        
                                                }#if end
                                
                                        #假設剩下的沒有註解都是 value
                                        $info["value"]=$unFormatStr;
                                
                                        #函式說明:
                                        #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                                        #回傳結果:
                                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                        #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                        #$result["function"],當前執行的函式名稱.
                                        #$result["argu"],所使用的參數.
                                        #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                                        #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                                        #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
                                        #必填參數:
                                        #$conf["input"],字串,要檢查的字串.
                                        $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                                        #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                                        $conf["search::findSpecifyStrFormat"]["format"]="\${value};\${comment}";
                                        #可省略參數:
                                        #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                                        #$conf["varEqual"]=array(null,"found");
                                        #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                                        #$conf["varCon"]=array("no_tail"=>" not");
                                        #參考資料:
                                        #無.
                                        #備註:
                                        #無.
                                        $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                                        unset($conf["search::findSpecifyStrFormat"]);
                                
                                        #如果執行異常
                                        if($findSpecifyStrFormat["status"]==="false"){
                                        
                                                #設置錯誤識別
                                                $result["status"]="false";

                                                #設置錯誤訊息
                                                $result["error"]=$findSpecifyStrFormat;

                                                #回傳結果
                                                return $result;
                                        
                                                }#if end
                                                
                                        #如果有符合格式
                                        if($findSpecifyStrFormat["found"]==="true"){
                                        
                                                #儲存 value
                                                $info["value"]=$findSpecifyStrFormat["parsedVar"]["value"][0];
                                        
                                                #儲存 comment
                                                $info["comment"]=$findSpecifyStrFormat["parsedVar"]["comment"][0];
                                        
                                                }#if end
                                        
                                        #儲存該筆RR
                                        $result["content"][]=$info;
                                        
                                        #換下解析下筆RR
                                        continue 2;
                                
                                        }#if end
                                
                                #執行到這邊代表不是 SOA
                                
                                #尋找是否有(...)...的內容存在
                                #函式說明:
                                #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                                #回傳結果:
                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                #$result["function"],當前執行的函式名稱.
                                #$result["argu"],所使用的參數.
                                #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                                #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                                #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
                                #必填參數:
                                #$conf["input"],字串,要檢查的字串.
                                $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                                #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                                $conf["search::findSpecifyStrFormat"]["format"]="(\${value};\${comment}";
                                #可省略參數:
                                #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                                #$conf["varEqual"]=array(null,"found");
                                #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                                #$conf["varCon"]=array("no_tail"=>" not");
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                                unset($conf["search::findSpecifyStrFormat"]);
                        
                                #如果執行異常
                                if($findSpecifyStrFormat["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$findSpecifyStrFormat;

                                        #回傳結果
                                        return $result;
                                
                                        }#if end
                                        
                                #如果有 有符合 ($value);${comment} 的格式
                                if($findSpecifyStrFormat["found"]==="true"){
                                
                                        #儲存value
                                        $info["value"]="(".$findSpecifyStrFormat["parsedVar"]["value"][0];
                                
                                        #儲存comment
                                        $info["comment"]=$findSpecifyStrFormat["parsedVar"]["comment"][0];
                                
                                        #儲存 RR 的記錄
                                        $result["content"][]=$info;
                                        
                                        #跳到下一筆要解析的RR
                                        continue 2;
                                
                                        }#if end
                                
                                #執行到這邊代表沒有 (...)... 的內容存在
                                
                                #尋找是否有 (...) 的內容存在
                                #函式說明:
                                #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                                #回傳結果:
                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                #$result["function"],當前執行的函式名稱.
                                #$result["argu"],所使用的參數.
                                #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                                #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                                #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
                                #必填參數:
                                #$conf["input"],字串,要檢查的字串.
                                $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                                #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                                $conf["search::findSpecifyStrFormat"]["format"]="(\${value})";
                                #可省略參數:
                                #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                                #$conf["varEqual"]=array(null,"found");
                                #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                                #$conf["varCon"]=array("no_tail"=>" not");
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                                unset($conf["search::findSpecifyStrFormat"]);
                        
                                #如果執行異常
                                if($findSpecifyStrFormat["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$findSpecifyStrFormat;

                                        #回傳結果
                                        return $result;
                                
                                        }#if end
                                        
                                #如果有 有符合 ($value);${comment} 的格式
                                if($findSpecifyStrFormat["found"]==="true"){
                                
                                        #儲存value
                                        $info["value"]=$findSpecifyStrFormat["parsedVar"]["value"][0];
                                
                                        #儲存 RR 的記錄
                                        $result["content"][]=$info;
                                        
                                        #跳到下一筆要解析的RR
                                        continue 2;
                                
                                        }#if end
                                        
                                #執行到這邊代表沒有 (...) 的內容存在
                                
                                #尋找有無 "...";... 的內容存在
                                #函式說明:
                                #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                                #回傳結果:
                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                #$result["function"],當前執行的函式名稱.
                                #$result["argu"],所使用的參數.
                                #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                                #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                                #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
                                #必填參數:
                                #$conf["input"],字串,要檢查的字串.
                                $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                                #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                                $conf["search::findSpecifyStrFormat"]["format"]="\"\${value};\${comment}";
                                #可省略參數:
                                #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                                #$conf["varEqual"]=array(null,"found");
                                #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                                #$conf["varCon"]=array("no_tail"=>" not");
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                                unset($conf["search::findSpecifyStrFormat"]);
                        
                                #如果執行異常
                                if($findSpecifyStrFormat["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$findSpecifyStrFormat;

                                        #回傳結果
                                        return $result;
                                
                                        }#if end
                                        
                                #如果有 有符合 "$value";${comment} 的格式
                                if($findSpecifyStrFormat["found"]==="true"){
                                
                                        #儲存value
                                        $info["value"]="\"".$findSpecifyStrFormat["parsedVar"]["value"][0];
                                        
                                        #儲存comment
                                        $info["comment"]=$findSpecifyStrFormat["parsedVar"]["comment"][0];
                                
                                        #儲存 RR 的記錄
                                        $result["content"][]=$info;
                                        
                                        #跳到下一筆要解析的RR
                                        continue 2;
                                
                                        }#if end
                                        
                                #執行到這邊代表沒有 "$value";${comment} 的格式
                                
                                #尋找有無 "..." 的內容存在
                                #函式說明:
                                #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                                #回傳結果:
                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                #$result["function"],當前執行的函式名稱.
                                #$result["argu"],所使用的參數.
                                #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                                #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                                #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
                                #必填參數:
                                #$conf["input"],字串,要檢查的字串.
                                $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                                #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                                $conf["search::findSpecifyStrFormat"]["format"]="\"\${value}\"";
                                #可省略參數:
                                #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                                #$conf["varEqual"]=array(null,"found");
                                #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                                #$conf["varCon"]=array("no_tail"=>" not");
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                                unset($conf["search::findSpecifyStrFormat"]);
                        
                                #如果執行異常
                                if($findSpecifyStrFormat["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$findSpecifyStrFormat;

                                        #回傳結果
                                        return $result;
                                
                                        }#if end
                                        
                                #如果有 有符合 "$value" 的格式
                                if($findSpecifyStrFormat["found"]==="true"){
                                
                                        #儲存value
                                        $info["value"]="\"".$findSpecifyStrFormat["parsedVar"]["value"][0]."\"";
                                        
                                        #儲存 RR 的記錄
                                        $result["content"][]=$info;
                                        
                                        #跳到下一筆要解析的RR
                                        continue 2;
                                
                                        }#if end
                                        
                                #執行到這邊代表沒有 "$value" 格式的內容
                                
                                #檢查是否有 $value;$comment 格式的內容
                                #函式說明:
                                #尋找字串中是否含有符合格式的內容,且回傳解析好的變數數值.
                                #回傳結果:
                                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                                #$result["function"],當前執行的函式名稱.
                                #$result["argu"],所使用的參數.
                                #$result["found"],是否有找到符合格式的字串內容,"true"代表有找到,"false"代表沒有找到.
                                #$result["content"],陣列,若為n個${*},則當found為"true"時,就會回傳n個元素.
                                #$result["parsedVar"][varName],陣列,解析好的變數陣列,varName為${}中的內容.
                                #必填參數:
                                #$conf["input"],字串,要檢查的字串.
                                $conf["search::findSpecifyStrFormat"]["input"]=$unFormatStr;
                                #$conf["format"],格式字串,要尋找的格式字串.格式為固定的字串("fixedStr format")與變數("${keyWordVarName}")組成.
                                $conf["search::findSpecifyStrFormat"]["format"]="\${value};\${comment}";
                                #可省略參數:
                                #$conf["varEqual"],陣列,變數對應的數值,null代表不指定,其他內容代表該變數解析出來必須要為該內容.
                                #$conf["varEqual"]=array(null,"found");
                                #$conf["varCon"],陣列,每個varEqual為null者,其是否有其他條件,預設為null代表無其他條件,條件的表示是用陣列的key與value來表達,例如:array("no_tail"=>" not"),就代表變數的結尾不能為" not",可以用的key有"head",代表開頭要有什麼;"no_head",代表不能為什麼開頭;"tail",代表要什麼結尾;"no_tail",代表不能什麼結尾.
                                #$conf["varCon"]=array("no_tail"=>" not");
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $findSpecifyStrFormat=search::findSpecifyStrFormat($conf["search::findSpecifyStrFormat"]);
                                unset($conf["search::findSpecifyStrFormat"]);
                        
                                #如果執行異常
                                if($findSpecifyStrFormat["status"]==="false"){
                                
                                        #設置錯誤識別
                                        $result["status"]="false";

                                        #設置錯誤訊息
                                        $result["error"]=$findSpecifyStrFormat;

                                        #回傳結果
                                        return $result;
                                
                                        }#if end
                                        
                                #如果有 有符合 "$value" 的格式
                                if($findSpecifyStrFormat["found"]==="true"){
                                
                                        #儲存value
                                        $info["value"]=$findSpecifyStrFormat["parsedVar"]["value"][0];
                                        
                                        #儲存comment
                                        $info["comment"]=$findSpecifyStrFormat["parsedVar"]["comment"][0];
                                        
                                        #儲存 RR 的記錄
                                        $result["content"][]=$info;
                                        
                                        #跳到下一筆要解析的RR
                                        continue 2;
                                
                                        }#if end
                        
                                #執行到這邊代表沒有 ${value};${comment} 格式的內容
                                
                                #亦即剩下的內容都是 value
                                
                                #儲存value
                                $info["value"]=$unFormatStr;
                                
                                #儲存 RR 的記錄
                                $result["content"][]=$info;
                                
                                #跳到下一筆要解析的RR
                                continue 2;
                                
                                }#while end
                        
                        }#foreach end
                
                #如果要debug
                if($conf["debug"]==="true"){
                
                        #函式說明:
                        #撰寫log
                        #回傳結果:
                        #$result["status"],狀態,"true"或"false".
                        #$result["error"],錯誤訊息陣列.
                        #$result["function"],當前函式的名稱.
                        #$result["argu"],使用的參數.
                        #$result["content"],要寫入log的內容字串.
                        #必填參數:
                        #$conf["path"],字串,log檔案的路徑與名稱.
                        $conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
                        #$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
                        $conf["logs::record"]["content"]="lineNo:".__LINE__." parse RR fin.".PHP_EOL;
                        #$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
                        $conf["logs::record"]["fileArgu"]=__FILE__;
                        #可省略參數:
                        #$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
                        #$conf["rewrite"]="false";
                        #$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
                        #$conf["returnOnly"]="true";
                        #參考資料:
                        #無.
                        #備註:
                        #無.
                        $record=logs::record($conf["logs::record"]);
                        unset($conf["logs::record"]);
                
                        }#if end
                
                #$conf["add"],多維陣列,每個元素有為有三個元素的陣列,key有"query"跟"update"跟"type"跟"value"以及"comment",分別代表要查詢的數值、更新周期、類型、答案、註解.
                
                #針對每個要新增的RR記錄
                foreach($conf["add"] as $newRR){
                        
                        #針對 zone file 中既有的每個RR記錄
                        foreach($result["content"] as $index => $oldRR){
                        
                                #如果既有的跟新的RR都為 $ORIGIN
                                if($oldRR["type"]==="\$ORIGIN" && $newRR["type"]==="\$ORIGIN"){
                                
                                        #取代既有的 RR
                                        $result["content"][$index]=$newRR;
                                        
                                        #換看下一筆newRR
                                        continue 2;
                                        
                                        }#if end
                                        
                                #如果既有的跟新的RR都為 $TTL
                                if($oldRR["type"]==="\$TTL" && $newRR["type"]==="\$TTL"){
                                
                                        #取代既有的 RR
                                        $result["content"][$index]=$newRR;
                                        
                                        #換看下一筆newRR
                                        continue 2;
                                        
                                        }#if end
                        
                                #如果新舊資料都有query資訊
                                if( isset($newRR["query"]) && isset($oldRR["query"]) ){
                                
                                        #如果跟既有的 query、type、value 有相同
                                        if($newRR["query"]===$oldRR["query"] && $newRR["type"]===$oldRR["type"] && $newRR["value"]===$oldRR["value"] ){
                                        
                                                #如果新 RR 有 update time
                                                if(isset($newRR["update"])){
                                                
                                                        #如果新舊 update time 不相同
                                                        if( $newRR["update"] !== $oldRR["update"] ){
                                                        
                                                                #取代既有的 RR
                                                                $result["content"][$index]=$newRR;
                                                                
                                                                #換看下一筆newRR
                                                                continue 2;
                                                                
                                                                }#if end
                                                
                                                        }#if end
                                                        
                                                #反之既有的 update time 若跟 global TTL 不一樣
                                                else if( $oldRR["update"] !== $result["defaultTTL"] ){
                                                
                                                        #更新為 global TTL
                                                        $result["content"][$index]["update"]=$result["defaultTTL"];
                                                        
                                                        }#if end
                                                        
                                                #如果新 RR 有 comment
                                                if( isset($newRR["comment"]) ){
                                                
                                                        #更新既有 RR 的 comment
                                                        $result["content"][$index]["comment"]=$newRR["comment"];
                                                
                                                        #換看下一筆newRR
                                                        continue 2;
                                                
                                                        }#if end
                                                        
                                                #反之,如果有既有 comment
                                                else if(isset($result["content"][$index]["comment"])){
                                                
                                                        #移除既有 comment
                                                        unset($result["content"][$index]["comment"]);
                                                        
                                                        #換看下一筆newRR
                                                        continue 2;
                                                
                                                        }#else end
                                        
                                                }#if end
                                
                                        }#if end
                                        
                                }#foreach end
                                
                        #儲存確定要新增的RR
                        $result["content"][]=$newRR;
                
                        }#foreach end
                
                #/*
                #debug
                #函式說明:
                #撰寫log
                #回傳結果:
                #$result["status"],狀態,"true"或"false".
                #$result["error"],錯誤訊息陣列.
                #$result["function"],當前函式的名稱.
                #$result["argu"],使用的參數.
                #$result["content"],要寫入log的內容字串.
                #必填參數:
                #$conf["path"],字串,log檔案的路徑與名稱.
                $conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
                #$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
                $conf["logs::record"]["content"]="lineNo:".__LINE__." total RR record count:".count($result["content"])." list:".PHP_EOL;
                #$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
                $conf["logs::record"]["fileArgu"]=__FILE__;
                #可省略參數:
                #$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
                #$conf["rewrite"]="false";
                #$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
                #$conf["returnOnly"]="true";
                #參考資料:
                #無.
                #備註:
                #無.
                $record=logs::record($conf["logs::record"]);
                unset($conf["logs::record"]);
                #*/
                
                #/*
                #debug
                #函式說明:
                #撰寫log
                #回傳結果:
                #$result["status"],狀態,"true"或"false".
                #$result["error"],錯誤訊息陣列.
                #$result["function"],當前函式的名稱.
                #$result["argu"],使用的參數.
                #$result["content"],要寫入log的內容字串.
                #必填參數:
                #$conf["path"],字串,log檔案的路徑與名稱.
                $conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
                #$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
                $conf["logs::record"]["content"]=$result["content"];
                #$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
                $conf["logs::record"]["fileArgu"]=__FILE__;
                #可省略參數:
                #$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
                #$conf["rewrite"]="false";
                #$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
                #$conf["returnOnly"]="true";
                #參考資料:
                #無.
                #備註:
                #無.
                $record=logs::record($conf["logs::record"]);
                unset($conf["logs::record"]);
                #*/
                
                #初始化要寫入的內容
                $strs2write=array();
                
                #針對每個RR記錄
                foreach($result["content"] as $RR){
                
                        #初始化暫存要寫入的行內容
                        $str2write="";
                
                        #如果是
                        if( $RR["type"]==="\$ORIGIN" || $RR["type"]==="\$TTL" ){
                        
                                #組合變數名稱與數值
                                $str2write=$str2write.$RR["type"]."\t".$RR["value"];
                                
                                }#if end
                        
                        #反之
                        else{
                        
                                #加上查詢的字句
                                $str2write=$str2write.$RR["query"];
                        
                                #如果該筆RR有指定update time該ZONE具備 global TTL.
                                if(isset($RR["update"])){
                                
                                        #如果 該ZONE具備 global TTL.
                                        if(isset($result["defaultTTL"])){
                                        
                                                #如果該筆 RR 的 update time 不等於 global TTL
                                                if($RR["update"]!==$result["defaultTTL"]){
                                                
                                                        #加上TTL的字句
                                                        $str2write=$str2write."\t".$RR["update"];
                                                
                                                        }#if end
                                        
                                                }#if end
                                
                                        #反之
                                        else{
                                        
                                                #加上TTL的字句
                                                $str2write=$str2write."\t".$RR["update"];
                                        
                                                }#else end
                                
                                        }#if end
                                
                                #反之且該ZONE不具備 global TTL.
                                else if(!isset($result["defaultTTL"])){
                                
                                        #加上global TTL的字句
                                        $str2write=$str2write."\t".$result["defaultTTL"];
                                
                                        }#if end
                                        
                                #加上IN跟TYPE跟value
                                $str2write=$str2write."\tIN\t".$RR["type"]."\t".$RR["value"];
                                
                                }#else end
                                
                        #如果有註解
                        if(isset($RR["comment"])){
                        
                                #加上comment
                                $str2write=$str2write.";".$RR["comment"];
                        
                                }#if end
                        
                        #如果要 debug
                        if($conf["debug"]==="true"){
                        
                                #函式說明:
                                #撰寫log
                                #回傳結果:
                                #$result["status"],狀態,"true"或"false".
                                #$result["error"],錯誤訊息陣列.
                                #$result["function"],當前函式的名稱.
                                #$result["argu"],使用的參數.
                                #$result["content"],要寫入log的內容字串.
                                #必填參數:
                                #$conf["path"],字串,log檔案的路徑與名稱.
                                $conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
                                #$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
                                $conf["logs::record"]["content"]="lineNo:".__LINE__." build RR record:".$str2write.PHP_EOL;
                                #$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
                                $conf["logs::record"]["fileArgu"]=__FILE__;
                                #可省略參數:
                                #$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
                                #$conf["rewrite"]="false";
                                #$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
                                #$conf["returnOnly"]="true";
                                #參考資料:
                                #無.
                                #備註:
                                #無.
                                $record=logs::record($conf["logs::record"]);
                                unset($conf["logs::record"]);
                        
                                }#if end
                        
                        #加上要寫入的元素
                        $strs2write[]=$str2write;
                
                        }#foreach end
                        
                #如果有逐行註解
                if(count($result["comment"])>0){
                
                        #加到結尾
                        #函式說明:
                        #將多個一維陣列串聯起來,key從0開始排序.
                        #回傳的結果:
                        #$result["status"],"true"表執行正常,"false"代表執行不正常.
                        #$result["error"],錯誤訊息陣列.
                        #$result["function"],當前執行的函數.
                        #$result["argu"],字串陣列,目前輸入的參數名稱陣列.
                        #$result["content"],合併好的一維陣列.
                        #必填參數
                        #$conf["inputArray"],陣列,要合併的一維陣列變數,例如:=array($array1,$array2);
                        $conf["arrays::mergeArray"]["inputArray"]=array($strs2write,$result["comment"]);
                        #可省略參數:
                        #$conf["allowRepeat"],字串,預設為"true",允許重複的結果;若為"false"則不會出現重複的元素內容.
                        #$conf["allowRepeat"]="true";
                        #$conf["looseDiff"],字串,預設為"false",代表要嚴謹判斷為有相異,例如陣列中元素的key順序不同(整數)就代表有相異;反之為"true",例如陣列中元素的key順序不同(非整數),但value有相同,則視為無相異.
                        #$conf["looseDiff"]="false";
                        #參考資料:
                        #無.
                        #備註:
                        #無.
                        $mergeArray=arrays::mergeArray($conf["arrays::mergeArray"]);
                        unset($conf["arrays::mergeArray"]);
                
                        #如果執行異常
                        if($mergeArray["status"]==="false"){
                        
                                #設置錯誤識別
                                $result["status"]="false";

                                #設置錯誤訊息
                                $result["error"]=$mergeArray;

                                #回傳結果
                                return $result;
                        
                                }#if end
                                
                        #取得合併好的陣列
                        $strs2write=$mergeArray["content"];
                
                        }#if end
                
                #如果要 debug
                if($conf["debug"]==="true"){
                
                        #函式說明:
                        #撰寫log
                        #回傳結果:
                        #$result["status"],狀態,"true"或"false".
                        #$result["error"],錯誤訊息陣列.
                        #$result["function"],當前函式的名稱.
                        #$result["argu"],使用的參數.
                        #$result["content"],要寫入log的內容字串.
                        #必填參數:
                        #$conf["path"],字串,log檔案的路徑與名稱.
                        $conf["logs::record"]["path"]="/tmp/zerossl::".__FUNCTION__;
                        #$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.
                        $conf["logs::record"]["content"]="lineNo:".__LINE__." total line to write:".count($strs2write).PHP_EOL;
                        #$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
                        $conf["logs::record"]["fileArgu"]=__FILE__;
                        #可省略參數:
                        #$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.
                        #$conf["rewrite"]="false";
                        #$conf["returnOnly"],預設為"false",會寫入到log檔案.若為"true"則不會寫入log.
                        #$conf["returnOnly"]="true";
                        #參考資料:
                        #無.
                        #備註:
                        #無.
                        $record=logs::record($conf["logs::record"]);
                        unset($conf["logs::record"]);
                        
                        }#if end
                
                #儲存新zone file每行的內容
                $result["newZoneFileContent"]=$strs2write;
                
                #如果要寫入ZONE檔案
                if($conf["writeNow"]==="true"){
                
                        #覆寫 ZONE file
                        #函式說明:
                        #更新檔案的內容.
                        #回傳結果:
                        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                        #$result["error"],錯誤訊息.
                        #$result["function"],當前執行的函數名稱.
                        #$result["content"],更新的資訊.
                        #$result["content"][$lineIndex]["ori"],原始 $lineIndex+1 行的內容,若為null則代表不存在.
                        #$result["content"][$lineIndex]["new"],新 $lineIndex+1 行的內容,若為null則代表不存在.
                        #必填參數:
                        #$conf["fileArgu"],字串,變數__FILE__的內容.
                        $conf["fileAccess::updateFile"]["fileArgu"]=__FILE__;
                        #$conf["file"],字串,要更新的檔案位置與名稱.
                        $conf["fileAccess::updateFile"]["file"]=$conf["dnsRecordFile"];
                        #可省略參數:
                        #$conf["overWriteWith"],字串陣列,要置換成什麼樣的內容,每個元素代表一行內容.
                        $conf["fileAccess::updateFile"]["overWriteWith"]=$strs2write;
                        #$conf["replaceWith"],字串陣列,要將什麼內容置換成什麼內容.
                        #$conf["replaceWith"]=array(array("ori content","new content"),array("ori content","new content"),...);
                        #$conf["replaceLike"],字串,預設為"false",代表要完全符合關鍵字才能進行整行替換;反之為"true".
                        #$conf["replaceLike"]="false";
                        #$conf["addToTailWhenNoMatch"],字串,預設為"false"不做事;若為"true",則代表若使用 "replaceWith" 參數但沒有符合條件的內容出現,則新增到檔案的尾端.
                        #$conf["addToTailWhenNoMatch"]="false";
                        #$conf["addToTailBeforeThat"],字串,當 "replaceWith" 參數有使用,且 "addToTailWhenNoMatch" 為 "true" 時,若有使用該參數,則會從尾端尋找符合條件的行內容,然後將 沒有符合 "replaceWith" 條件的內容新增在此之前.
                        #$conf["addToTailBeforeThat"]="?\>";
                        #$conf["replaceSpecifyLine"],字串陣列,將指定的行取代成指定的內容,元素的key為原始檔案的行索引,若key為$i+1,則代表第$i行;元素的數值就為該行的新內容.
                        #$conf["replaceSpecifyLine"]=array();
                        #$conf["outputPath"],字串,檔案要輸出到哪個位置,預設不指定,直接取代原始檔案的內容.
                        #$conf["outputPath"]="";
                        #參考資料:
                        #無.
                        #備註:
                        #無.
                        $updateFile=fileAccess::updateFile($conf["fileAccess::updateFile"]);
                        unset($conf["fileAccess::updateFile"]);
                
                        #如果執行異常
                        if($updateFile["status"]==="false"){
                        
                                #設置錯誤識別
                                $result["status"]="false";

                                #設置錯誤訊息
                                $result["error"]=$updateFile;

                                #回傳結果
                                return $result;
                        
                                }#if end
                
                        }#if end
                        
                #設置執行正常
                $result["status"]="true";
        
                #回傳結果
                return $result;
        
                }#function updateDnsRecordFile end

        /*
        #函式說明:
        #驗證已經透過zerossl::createCertificate要求的domain,並取得ssl憑證.
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$reuslt["error"],執行不正常結束的錯訊息陣列.
        #$result["function"],當前執行的函式名稱.
        #$result["argu"],所使用的參數.
        #$result["curl_verbose_info"],curl執行的詳細資訊.
        #$result["content"],字串,得到的json字串回應.
        #必填參數:
        #$conf["id"],字串,zerossl::createCertificate回傳的id.
        $conf["id"]="";
        #可省略參數:
        #$conf["apiDomain"],字串,提供服務的domain,預設為 self::getApiInfo()["doamin"].
        #$conf["apiDomain"]=self::getApiInfo()["doamin"];
        #$conf["key"],字串,api key,預設為 self::getApiInfo()["apiKey"].
        #$conf["key"]=self::getApiInfo()["apiKey"];
        #參考資料:
        #無.
        #備註:
        #無.
        */
        public static function verifyDomain(&$conf){
        
                #初始化要回傳的結果
                $result=array();

                #設置當其函數名稱
                $result["function"]=__FUNCTION__;

                #如果 $conf 不為陣列
                if(gettype($conf)!="array"){

                        #設置執行失敗
                        $result["status"]="false";

                        #設置執行錯誤訊息
                        $result["error"][]="\$conf變數須為陣列形態";

                        #如果傳入的參數為 null
                        if($conf==null){

                                #設置執行錯誤訊息
                                $result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";

                                }#if end

                        #回傳結果
                        return $result;

                        }#if end

                #取得參數
                $result["argu"]=$conf;

                #檢查參數
                #函式說明:
                #檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$reuslt["error"],執行不正常結束的錯訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
                #$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
                #$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
                #$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息
                #$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.
                #$result["argu"],字串陣列,目前輸入的參數名稱陣列.
                #$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
                #$result["notNeedVar"],字串陣列,多餘的參數名稱.
                #必填寫的參數:
                #$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
                $conf["variableCheck::checkArguments"]["varInput"]=&$conf;
                #$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("id");
                #$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object");
                $conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string");
                #$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
                $conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
                #可以省略的參數:
                #$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
                #$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
                #$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或集合.
                #$conf["skipableVariableCanNotBeEmpty"]=array();
                #$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
                $conf["variableCheck::checkArguments"]["skipableVariableName"]=array("apiDomain","key");
                #$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
                $conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","string");
                #$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
                $conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(self::getApiInfo()["apiDomain"],self::getApiInfo()["csrPath"],self::getApiInfo()["apiKey"]);
                #$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
                #$conf["arrayCountEqualCheck"][]=array();
                #參考資料來源:
                #array_keys=>http://php.net/manual/en/function.array-keys.php
                $checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
                unset($conf["variableCheck::checkArguments"]);

                #如果檢查失敗
                if($checkArguments["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end

                #如果檢查不通過
                if($checkArguments["passed"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$checkArguments;

                        #回傳結果
                        return $result;

                        }#if end
                        
                #要傳送的 key -> value
                $postArray=array();

                #設置要簽署的domain
                $postArray["validation_method"]="CNAME_CSR_HASH";
                
                #設置要傳送的 json
                $postJson=json_encode($postArray);

                #函式說明:
                #運行curl cmd
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["error"],錯誤訊息陣列.
                #$result["function"],當前執行的函式名稱.
                #$result["founded"],識別網址找不找得到.
                #$result["content"],取得的回應內容陣列;若$conf["bgInProc"]為"true",則每個元素為其指令執行的結果訊息陣列,key為"status"代表執行是否正常的識別;key為"statusCode"代表程式結束後回傳給對應executeBy程式的數值;key為"output"代表標準輸出,若為resource,則代表為pipe;key為"error"代表非標準輸出,若為resource,則代表為pipe;key為"input"代表成功輸入的指令;key為"process"代表該程序經proc_open後的process source;key為"proc_get_status"代表程序的資訊.
                #$result["fullContent"],取得回應的完整字串內容.
                #$result["cookie"],cookie檔案的位置與名稱.
                #$result["cmd"],執行的command.
                #$result["argu],使用的參數.
                #必填參數:
                #$conf["url"],字串,目標url.
                $conf["catchWebContent::curlCmd"]["url"]="https://".$conf["apiDomain"]."/".$conf["id"]."/challenges";
                #$conf["fileArgu"],字串,變數__FILE__的內容.
                $conf["catchWebContent::curlCmd"]["fileArgu"]=__FILE__;
                #可省略參數:
                #$conf["header"],字串陣列,要傳送的header.
                $conf["catchWebContent::curlCmd"]["header"]=array("content-type: application/json");
                #$conf["allowAnySSLcertificate"],字串,是否允許不可信任的SSL憑證,預設為"true".
                #$conf["allowAnySSLcertificate"]="";
                #$conf["postVar"],字串陣列,每個要傳送的post變數名稱(陣列的key值)與數值.
                #$conf["postVar"]=array();
                #$conf["rawPost"]="字串",要傳送的raw post內容.
                $conf["catchWebContent::curlCmd"]["rawPost"]=$postJson;
                #$conf["urlEncode"],字串,post的內容是否要url_encode,"true"代表要,預設為"false"代表不要.
                #$conf["catchWebContent::curlCmd"]["urlEncode"]="true";
                #$conf["agent"],字串,user agent的名稱.
                #$conf["agent"]="";
                #$conf["cookie"],字串,cookie位置與檔案位置.
                #$conf["cookie"]="";
                #$conf["forceNewCookie"],字串,是否要重置cookie,"true"代表要,"false"代表不要,預設為"false".
                #$conf["forceNewCookie"]="";
                #$conf["inBg"],字串,"true"代表要在背景中執行;反之則為"false".
                #$conf["inBg"]="true";
                #$conf["bgInPorc"],字串,若跟inBg一樣為"true",則會透過proc放在背景執行且回傳proc資訊,以便監控執行狀況.預設為"false",不使用proc.
                #$conf["bgInProc"]="false";
                #參考資料:
                #無.
                #備註:
                #無.
                $curlCmd=catchWebContent::curlCmd($conf["catchWebContent::curlCmd"]);
                unset($conf["catchWebContent::curlCmd"]);

                #如果異常
                if($curlCmd["status"]==="false"){

                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$curlCmd;

                        #回傳結果
                        return $result;

                        }#if end

                #設置curl的詳細資訊
                $result["curl_verbose_info"]=$curlCmd;

                /* 範例 response json content
                
                */

                #驗證結果是否為 json
                $json_validate=json_validate($curlCmd["fullContent"]);

                #如果回應不是 json
                if(!$json_validate){
                
                        #設置錯誤識別
                        $result["status"]="false";

                        #設置錯誤訊息
                        $result["error"]=$curlCmd;

                        #回傳結果
                        return $result;
                
                        }#if end

                #設置json string結果
                $result["content"]=$curlCmd["fullContent"];

                #解析json
                $jsonRes=json_decode($result["content"]);
                
                #設置執行正常
                $result["status"]="true";
        
                #回傳結果
                return $result;
        
                }#function verifyDomain end

        }#class zerossl end