得到错误:无法找到指定的类:codeigniter中的Session.php

时间:2019-03-21 06:43:41

标签: php codeigniter session shopify

在定义用于加载自定义配置文件的父结构之后,我在utilManager的CodeIgniter上创建了自己的库,名为CI_Controller。在执行应用程序时,出现Unable to locate the specified class: Session.php错误。

我的图书馆控制器:

<?php
namespace UtilManager;
use CI_Controller;
use Exception;
use stdClass;

defined('BASEPATH') OR exit('No direct script access allowed');

class Util extends CI_Controller{
    private $_shopify_secret;
    private $_shopify_api_key;
    private $_hostname;
    private $_main_url;

    public function __construct($config = 'utils'){
        parent::__construct();

        $this->get_local_config($config);
        $this->_shopify_secret = $this->config->item('shopify_secret');
        $this->_shopify_api_key = $this->config->item('shopify_api_key');
        $this->_hostname = $this->config->item('hostname');
        $this->_main_url = "https://".$this->_shopify_api_key.":".$this->_shopify_secret."@".$this->_hostname."/";
    }

    public function main_url(){
        // echo "yes";
        return $this->_main_url;
    }

    /**
     * @param $config_file
     */
    private function get_local_config($config_file){
        if(file_exists(__DIR__."/../config/".$config_file.".php")) {
            $config = array();
            include(__DIR__ . "/../config/" . $config_file . ".php");
            foreach($config AS $key => $value) {
                $this->config->set_item($key, $value);
            }
        }
        $this->load->config($config_file, FALSE, TRUE);
    }
}

主控制器

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

require APPPATH . 'libraries/Util_Manager.php';
class Home extends CI_Controller {
    function __construct(){
        parent::__construct();
    }
    public function index(){
        $util = new UtilManager\Util();
     // $shopify_url = $this->_main_url."admin/products.json";
        print_r($util->main_url());
        exit;
    }
}

在这里,我试图为Shopify base_url创建一个通用的util管理器,其中密钥和私钥在配置文件中可用。欢迎提出想法。预先感谢。

0 个答案:

没有答案