ซึ่งเมื่อเรียกใข้งาน function render() ก็พบว่ามี error เกิดขึ้นระบุว่า สมาชิกทีส่งเป็นค่าว่าง ดังภาพ
Fatal error: Call to a member function render() on null in /opt/lampp/htdocs/phpb3/ext/mindphp/sample1/controller/main.php on line 26
จึงอยากทราบว่า จะต้องแก้ไข้ ตรวจสอบ หรือเพิ่มเติม ที่ส่วนไหนบ้าง
อันนี้คือโคด main.php ซึ่งเป็นส่วนที่เกิด error เป็นไฟล์ ที่ได้มีการรระบุ function render() ลงไป
โค้ด: เลือกทั้งหมด
<?php
namespace mindphp\sample1\controller;
class main {
protected $config;
protected $template;
protected $user;
protected $helper;
protected $root_path;
protected $php_ext;
public function _construct(\phpbb\config\config $config, \phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper, $root_path, $php_ext) {
$this->config = $config;
$this->template = $template;
$this->user = $user;
$this->helper = $helper;
$this->root_path = $root_path;
$this->php_ext = $php_ext;
}
function base($page = 1) {
return $this->helper ->render('sample1.html');
}
}