Blame | Last modification | View Log | RSS feed
<?php#使用命名空間qbpwcfnamespace qbpwcf;#assets dir$assetsDir="assets of cmd::chmod_20240325";#函式說明:#使用 linux 的 chmod 指令來修改目標檔案或目錄的權限.#回傳結果:#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.#$result["error"],錯誤訊息.#$result["function"],當前執行的函式名稱.#$result["cmd"],執行的指令.#$result["content"],執行的結果陣列,如果參數 "recursive" 跟 "excludeSelf" 都有設定的話,就會回傳該結果.#必填參數:#$conf["mode"],字串,要變成什麼權限.$conf["mode"]="7771";#$conf["target"],字串,需要變更權限的目標.$conf["target"]=$assetsDir;#可省略參數:#$conf["recursive"],字串,"true"代表目標目錄底下的內容都要套用,預設為"false".$conf["recursive"]="true";#$conf["excludeSelf"],字串,預設為"false"代表不處理;若為"true"則會排除目標自己(資料夾).#$conf["excludeSelf"]="true";#參考資料:#無.#備註:#無.$chmod=cmd::chmod($conf);unset($conf);#如果執行失敗if($chmod["status"]==="false"){#函式說明:#撰寫log#回傳結果:#$result["status"],狀態,"true"或"false".#$result["error"],錯誤訊息陣列.#$result["function"],當前函式的名稱.#$result["argu"],使用的參數.#必填參數:#$conf["path"],字串,log檔案的路徑與名稱.$conf["path"]=$logFile;#$conf["content"],any,要寫的內容,若內容不為字串則會用var_dump的格式寫入.$conf["content"]=$chmod;#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑$conf["fileArgu"]=__FILE__;#可省略參數:#$conf["rewrite"],預設為"false",接續寫入;反之"true"代表重新寫入.#$conf["rewrite"]="false";#參考資料:#無.#備註:#無.$record=logs::record($conf);unset($conf);#如果寫log失敗if($record["status"]==="false"){#印出結果var_dump($record);}#if end#結束執行,回傳錯誤代碼1exit(1);}#if end#debugvar_dump($chmod);