【问题标题】:Trouble Importing PHP Class within the same project在同一项目中导入 PHP 类时遇到问题
【发布时间】:2014-11-07 05:04:22
【问题描述】:

有人可以帮助我解决使用“命名空间”、“使用”(php v5.3 或更高版本)在同一项目(调用类)中引用 php 文件的问题 [我的截图][http://i.imgur.com/6GC4UUK.png?1]

致命错误:在中找不到类“Zoho\CRM\Common\HttpClientInterface” C:\root\zohocrm-master\src\Zoho\CRM\index.php 在第 73 行

  <?php namespace Zoho\CRM;

    use Zoho\CRM\Common\HttpClientInterface;
    use Zoho\CRM\Common\FactoryInterface;
    use Zoho\CRM\Request\HttpClient;
    use Zoho\CRM\Request\Factory;
    use Zoho\CRM\Wrapper\Element;    
                    .
                    .
                    .

public function __construct($authtoken, HttpClientInterface $client =null , FactoryInterface $factory = null )
        {
            $this->authtoken = $authtoken;
            // Only XML format is supported for the time being
            $this->format = 'xml'; 


             $this->client = new HttpClientInterface();
            $this->factory = $factory ;
            $this->module = "Leads";
            return $this;
        }

【问题讨论】:

  • 很遗憾,您的下载链接已损坏。请在此处添加相关代码,让我们知道您已经尝试过什么。

标签: php html class import zoho


【解决方案1】:

Robinson,您正在从以下位置调用类“Zoho\CRM\Common**HttpClientInterface**”:“C:\root\zohocrm-master\src\Zoho\CRM**index.php**”。

这意味着您尝试使用命名空间的方式不正确。

记住,如果你这样做了:

use App\namespace\class_name

这意味着您的类“class_name”必须位于这样的文件夹中:App/namespace/。 所以当你调用 use 时,很好地定义你的类的路径。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-12-16
  • 2016-05-13
  • 1970-01-01
  • 1970-01-01
  • 2022-10-05
  • 1970-01-01
  • 2017-07-29
相关资源
最近更新 更多