简体   繁体   English

使用Factual的PHP错误

[英]A PHP Error using Factual

I am using Codeigniter as my PHP framework. 我使用Codeigniter作为我的PHP框架。 When I run the factual API I get results but there are PHP warnings. 当我运行事实API我得到结果但有PHP警告。

Severity: Warning 

Message: include(/home/bwilson/public_html/factual/CI_DB.php): failed to open stream: No such file or directory 

Filename: factual/Factual.php 

Line Number: 217 

Severity: Warning 

Message: include(): Failed opening '/home/bwilson/public_html/factual/CI_DB.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') 

Filename: factual/Factual.php 

Line Number: 217 

I a look at line 217 in the factual.php file and it reads: 我看一下factual.php文件中的第217行,它显示为:

include dirname(__FILE__)."/".$className . ".php"; 

What is the referring to? 什么是指? I have tested this without running the Factual API and the controllers load find. 我在没有运行Factual API并且控制器加载查找的情况下对此进行了测试。 It is only when I start using the Factual API. 只有当我开始使用Factual API时。

This is the reply I received from Factual: 这是我从Factual收到的回复:

The driver employs an SPL Autoload function to include files for unloaded classes dynamically. 驱动程序使用SPL自动加载功能动态地包含卸载类的文件。

Here, the class CI_DB -- a Codeigniter class, not Factual -- is being called without being loaded first. 这里,类CI_DB - 一个Codeigniter类,而不是Factual - 在没有先加载的情况下被调用。 This triggers our autoload feature in a final attempt to load the file. 这会在最终尝试加载文件时触发我们的自动加载功能。

In short: this is not a Factual driver issue; 简而言之:这不是一个事实的驱动因素问题; to solve, ensure the file containing the CI_DB class is loaded properly. 要解决,请确保正确加载包含CI_DB类的文件。

It's just trying to find CI_DB.php in the same folder as factual.php . 它只是试图在与CI_DB.php相同的文件夹中找到factual.php

Make sure that file actually exists where it's trying to find it. 确保该文件确实存在于它试图找到它的位置。 Pay attention to what case the filename is. 注意文件名是什么情况。

If the file does indeed exist where its supposed to, check its permissions. 如果文件确实存在于其应有的位置,请检查其权限。

After looking for into the error returns unsupported modules. 寻找错误后返回不支持的模块。 I just disabled the error reporting in the index.php file by setting error reporting to production. 我刚刚通过将错误报告设置为生产来禁用index.php文件中的错误报告。 In the mean time I am okay with it as long as my results are the same. 同时,只要我的结果相同,我就可以使用它。

Thank you everyone that contributed. 谢谢大家的贡献。

你用吗?:

require_once BASEPATH . "/{$className}.php";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM