我正在尝试从控制器文件中调用 CakePHP 中的第三方库函数。
我的控制器文件中有这个:
public function index() {
App::import('vendor', 'simple-html-dom.php');
App::import('vendor', 'utils.php');
set_time_limit(0);
$html = file_get_html("google.com");
...
}
我也有和app/vendor
文件。simple-html-dom.php
utils.php
file_get_html
是一个公共函数simple-html-dom.php
(并且它不属于任何类)。我最终得到这个错误:
Error: Call to undefined function file_get_html()
我一直在寻找如何解决这个问题,但我没有找到答案。