【发布时间】:2014-04-23 15:05:44
【问题描述】:
我试图在另一个函数中调用一个函数。根据他们所说的使用
的一些研究$this->
应该可以。但它给了我
致命错误:不在对象上下文中使用 $this
function addstring($input, $addition_string , $position) {
$output = substr_replace($input, $addition_string, $position, 0);
return $output;
}
function test($astring) {
$output2 = $this->addstring($astring, 'asd', 1);
}
查看我的其余代码:
错误:
致命错误:在第 48 行的 BLA.php 中不在对象上下文中时使用 $this
【问题讨论】:
-
“查看我的其余代码” --- 你有足够的代表点来发布它。
-
删除
$this-> -
或者更好的是,添加一个类。
-
$this->表示当前类