我很新,有一些试验和测试创建一个类和对象。PHP:如何使用类函数?
这里是我的脚本:
<?php
class testingm
{
private $t;
public function __construct($file)
{
$this->t = fopen($file, 'rb')
}
}
$test = new testingm;
$s = new file($_GET['n']);
?>
脚本说
警告:缺少参数1 testingm :: __结构(),称为
我怎样才能为$提供一个值文件变量?有人可以指导我吗?
'尝试'是保留关键词。所以给你的班级一个不同的名字。然后使用print_r($ _GET)打印$ _GET。另外,为什么不提供file()的文件路径。例如文件('/ path/to/file.txt')用于测试目的 – vsingh