I encountered a problem when using TP to integrate the Alipay account binding function
There is a file config.class.php under the ORM
After direct import(), I found that the variables in it cannot be used, but it is indeed loaded. . (The content is successfully output in config.class.php)
I have been thinking about Baidu for a long time. .
It turns out that I have always known that JS scope ignores that PHP functions also have scope - -
Specific principle:
Copy code The code is as follows:
class b{
function test(){
myImport("a.php");
$testClass = new impClass();
$testClass->test();
echo $a."from b";
}
}
class a{
function funa(){
$InsB = new b();
$InsB->test();
}
}
function myImport($file){
require $file;
echo $a."from myImport";
}
$InsA = new a();
$InsA->funa();
?>
a.php
$a = "a";
class impClass{
function test(){
echo "import success";
}
}
?>
Display:
http://www.bkjia.com/PHPjc/327726.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327726.htmlTechArticleI ran into a problem when using TP to integrate the Alipay account binding function. There is a file config.class.php under the ORM. Import it directly. () and found that the variables inside cannot be used but they are indeed loaded. . (In conf...