我有问题让我的sparks安装与我的codeigniter安装一起工作
以下是我采取的步骤如下:
>我通过我的PHPCLI访问了我的codeigniter项目文件夹的根目录,使用以下命令安装sparks
PHP -r "$(curl -fsSL http://getsparks.org/go-sparks)"
>我使用下面的spark命令安装了活动记录库
PHP tools\spark install -v0.0.2 PHP-activerecord
2A.这个命令给了我下面的文件夹结构
-application
-sparks
-PHP-activerecord
-0.0.2
-config
-variables
-vendor
-system
-tests
-tools
-lib
-spark
-sparktypes
-test
-user_guide
2B.此命令生成一个包含PHP活动记录文件夹的sparks,它构成了PHP-activerecord的必要组件,该命令使用生成的MY_Loader.PHP文件看起来像这样
PHP if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Sparks
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author CodeIgniter Reactor Dev Team
* @author Kenny Katzgrau PHP file contains an array that permits sub-systems,* libraries,and helpers to be loaded automatically.
*
* @param array|null $basepath
* @return void
*/
function ci_autoloader($basepath = NULL)
{
if($basepath !== NULL)
{
$autoload_path = $basepath.'config/autoload'.EXT;
}
else
{
$autoload_path = APPPATH.'config/autoload'.EXT;
}
if(! file_exists($autoload_path))
{
return FALSE;
}
include($autoload_path);
if ( ! isset($autoload))
{
return FALSE;
}
if($this->_is_lt_210 || $basepath !== NULL)
{
// Autoload packages
if (isset($autoload['packages']))
{
foreach ($autoload['packages'] as $package_path)
{
$this->add_package_path($package_path);
}
}
}
// Autoload sparks
if (isset($autoload['sparks']))
{
foreach ($autoload['sparks'] as $spark)
{
$this->spark($spark);
}
}
if($this->_is_lt_210 || $basepath !== NULL)
{
if (isset($autoload['config']))
{
// Load any custom config file
if (count($autoload['config']) > 0)
{
$CI =& get_instance();
foreach ($autoload['config'] as $key => $val)
{
$CI->config->load($val);
}
}
}
// Autoload helpers and languages
foreach (array('helper','language') as $type)
{
if (isset($autoload[$type]) AND count($autoload[$type]) > 0)
{
$this->$type($autoload[$type]);
}
}
// A little tweak to remain backward compatible
// The $autoload['core'] item was deprecated
if ( ! isset($autoload['libraries']) AND isset($autoload['core']))
{
$autoload['libraries'] = $autoload['core'];
}
// Load libraries
if (isset($autoload['libraries']) AND count($autoload['libraries']) > 0)
{
// Load the database driver.
if (in_array('database',$autoload['libraries']))
{
$this->database();
$autoload['libraries'] = array_diff($autoload['libraries'],array('database'));
}
// Load all other libraries
foreach ($autoload['libraries'] as $item)
{
$this->library($item);
}
}
// Autoload models
if (isset($autoload['model']))
{
$this->model($autoload['model']);
}
}
}
}
>我修改我的autoload.PHP以包括PHP活动记录,如下所示
$autoload['sparks'] = array('PHP-activerecord/0.0.2');
当我运行我的codeigniter网站时,我得到以下错误
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant EXT - assumed 'EXT'
Filename: core/MY_Loader.PHP
Line Number: 174
Backtrace:
File: C:\xampp\htdocs\orm\application\core\MY_Loader.PHP
Line: 174
Function: _exception_handler
File: C:\xampp\htdocs\orm\application\core\MY_Loader.PHP
Line: 154
Function: ci_autoloader
File: C:\xampp\htdocs\orm\application\core\MY_Loader.PHP
Line: 67
Function: initialize
File: C:\xampp\htdocs\orm\index.PHP
Line: 274
Function: require_once
最佳答案