【问题标题】:Referencing other scripts from within my controller从我的控制器中引用其他脚本
【发布时间】:2012-02-17 23:19:59
【问题描述】:

我是 Code Igniter 的新手。我想在我的应用程序中使用一些 3rd 方类。第一个是帮助与 POstmark 电子邮件服务交互的类。

我尝试将类放入库中并从我的控制器中调用它:

 require("../libraries/postmark.php");

但这导致没有这样的文件或目录错误。放置此类文件的最佳位置在哪里以及如何在控制器中引用它们

【问题讨论】:

标签: php codeigniter


【解决方案1】:

文档对这些事情非常清楚

http://codeigniter.com/user_guide/general/creating_libraries.html

你基本上把你的类放在库目录中,然后创建一个实例......

$this->load->library('postmark');

然后您可以使用以下语法调用您的邮戳函数:

$this->postmark->function1();
$this->postmark->function2();    

虽然这可能不是最完整的示例,但我没有理由重写我刚刚链接到的文档。希望对您有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多