【发布时间】:2013-01-16 01:58:34
【问题描述】:
我的问题是,我希望使用 Php Simple Html Dom Parser 但是,该文件似乎只是一组 functions 而不是 class SomeClass{} 声明,因此很难嵌入为 自定义 library 在 codeigniter 中,就像我声明它之后一样。
$this->load->library('someclass');
我已将此代码放入 Simple Html Dom Parser 的 pastebin 中: http://pastebin.com/0rR6Kiex
我想知道如何通过我定义的类轻松地使所有这些功能可用:
class MyClass{
## contents of pastebin here
}
所以我可以在 codeigniter 中加载,例如:
$this->load->library('myclass');
$thus->myclass->fetchlinks();
目前,我正在尝试手动要求一个 php 文件,这有点违背了使用 codeigniter 的意义:
function fetchlinks(){
## include the Simpledom framework #########################################################
include "localhost/mysite/assets/php/Simpledom.php" or die('Error occured on page'); #
}
【问题讨论】:
-
感谢您的链接,我目前已经看到了。它不是 CI 的问题,而是库“Simple Dom Parser”设置的问题。 (你会在我提供的 pastebin 中看到)
标签: php codeigniter parsing customization