|
 |
|
ใครว่างมาช่วยอธิบายcode function นี้ให้หน่อยครับยิงดูยิ่งงงหรือผมไม่รู้จักตัวแปรมัง ?? |
|
 |
|
|
 |
 |
|
Code (PHP)
function GETMODULE($name,$file){ //ตรงนี้หมายความว่าในfunction getmodule มีค่าของ ตัวแปร name และ file
global $MODPATH, $MODPATHFILE ; //ตัวแปร Global ือตัวแปรที่สามารถเรียกใช้ได้ทุกส่วนของโปรแกรม
if(!$name){$name = "index";} //ตรงนี้หมายความว่าถ้าไม่มีค่าใน ตัวแปรname ให้nameมีค่าเท่ากับ inde
if(!$file){$file = "index";} //ตรงนี้หมายความว่าถ้าไม่มีค่าใน ตัวแปรflie ให้fileมีค่าเท่ากับ index
$modpathfile="modules/".$name."/".$file.".php"; //กำหนดค่าต่า $name มีค่า index ก็จะได้ "modules/index/index.php" คือการเอาค่าจากตัวแปรมารวมกับ string
if (file_exists($modpathfile)) { //ตรวจสอบว่า path "modules/index/index.php" มีอยู่จริวหรือไม่
$MODPATHFILE = $modpathfile; //$MODPATHFILE = "modules/index/index.php"
$MODPATH = "modules/".$name."/"; //$MODPATH = "modules/index/"
}else{
die ("This page it not have ...");
}
}
|
 |
 |
 |
 |
Date :
2010-09-05 19:27:59 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|