さて、私の を見てくださいpage.php
。その中で私の問題を説明します。
<?php
$var= "<p>Hello world</p>";
function myfunction1($a){
echo $a;
}
//then
myfunction1($var);//-->OK, return "Hello world!"
//but, the thing is, i don't want to pass any argument into myfunction(),
//so i have to import the external $var into myfuntion2()
function myfunction2(nothing here){
//what's here?
}
myfunction2();//i want to do this
?>
もちろん、これらすべてを CLASS 内にラップしmyfunction()
て$var
( method $amp; property
OOP スタイル) にすると、これらに簡単にアクセスできます! でも、やりたくない!
それで、それは可能ですか?誰でも私に提案をすることができますか?ありがとう