Rev 835 | 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) 2015~2024 Min-Jhin,ChenThis file is part of QBPWCF.QBPWCF is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe 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 ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with QBPWCF. If not, see <http://www.gnu.org/licenses/>.*/#使用命名空間qbpwcfnamespace qbpwcf;#匯入套件require_once("qbpwcf/allInOne.php");#建議的log位置$logFile=$_SERVER["DOCUMENT_ROOT"].$_SERVER["PHP_SELF"].".log";#要使用的範例name$nameOfSample="window.qbpwcf.clientFile";$nameOfSample="window.qbpwcf.clientFile user candeled";$nameOfSample="window.qbpwcf.openWindow";#存放範例的資料夾$sampleFolder="javaScript::qbpwcfJavaScript";#設置測試案例的檔案名稱與路徑$fileNameOfSample=$sampleFolder."/".$nameOfSample.".php";#初始化儲存範例代碼$samples=array();#增加 javaScript::qbpwcfJavaScript 的範例資訊$samples[]=array("name"=>"window.qbpwcf.clientFile","comnent"=>"test window.qbpwcf.clientFile");$samples[]=array("name"=>"window.qbpwcf.clientFile user candeled","comment"=>"test user canceled");$samples[]=array("name"=>"window.qbpwcf.openWindow","comment"=>"test write content feature of window.qbpwcf.openWindow");#針對每個範例資訊foreach($samples as $sample){#如果找到對應的範例if($sample["name"]===$nameOfSample){#如果存放範例的資料夾不存在if(!file_exists($sampleFolder)){#提示訊息echo "存放範例的資料夾(".$sampleFolder.")不存在".PHP_EOL;#結束執行,並回傳1給shellexit(1);}#if end#如果對應的範例檔案不存在if(!file_exists($fileNameOfSample)){#提示訊息echo "範例檔案(".$fileNameOfSample.")不存在".PHP_EOL;#結束執行,並回傳1給shellexit(1);}#if end#匯入範例require_once($fileNameOfSample);#結束執行exit;}#if end}#foreach end#執行到這邊代表沒有對應的範例#提示範例不存在echo "範例(".$nameOfSample.")不存在".PHP_EOL;#結束執行,並回傳1給shellexit(1);?>