如何通过包含类文件将值传递给我的类并将其用作$var
PHP5 中的该类内部?
到目前为止的代码:
// ScriptA
$cacheF=test;
include("ScriptB_MyClass.php");
$one = new MyClass(array('$cacheF'));
------------
// ScripB_MyClass.php
class MyClass {
var $cacheF;
function __construct() {
$this->cacheF = $cacheF;
return $this->cacheF = $cacheF;
}
$the_cache_path="/home/$cacheF/myfile.txt";
// execute other functions
}