我一直在使用CI一段时间,最近升级到CI 3.我注意到会话库现在已经移动到一个文件夹.我曾经在application/libraries文件夹中拥有自己的MY_Session.php文件,该文件扩展了默认的CI库.
我还使用autoload.php文件自动加载我的会话库.这不再有效,因为我无法加载请求的类:Session.
如果我删除了MY_Session.php文件,那么页面加载,但是我将丢失我的扩展功能.
有谁知道如何在CI 3中扩展会话库?
我正在为CodeIgniter 3.0(dev)寻找简单易用的/安装登录系统 .
我见过几个不同的脚本,但主要是CodeIgniter 2.x.
我将不胜感激任何帮助.
Your view folder path does not appear to be set correctly. Please open the following file and correct this: index.php我收到这个错误,我不知道有什么问题,我从官方网站下载了rc3(发布候选人3),解压缩它,添加了资产文件夹和帮助,当我运行应用程序时,我收到了错误Your view folder path does not appear to be set correctly. Please open the following file and correct this: index.php,这是我的index.php文件代码,图像显示了文件夹结构
// index.php code
<?php
/**
* CodeIgniter
*
* An open source application development framework for PHP
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2015, British …Run Code Online (Sandbox Code Playgroud) 在codeigniter 3应用程序中我有这样的目录结构:
-Myproject
-application
-controllers
-home
Welcome.php //This is my controller inside home directory
Run Code Online (Sandbox Code Playgroud)
如何将Welcome控制器设置为默认控制器?我使用下面的代码
$route['default_controller'] = 'home/Welcome';
Run Code Online (Sandbox Code Playgroud)
此路由适用于以前版本的codeigniter.
我正在创建使用Codeigniter和jquery Ajax自动上传图像的功能.用户将从他们的计算机中选择他们的图像,然后Ajax将通过Post发送到服务器.
问题:图像无法上传到服务器,在Ajax响应后,我得到了一个空的图像属性.似乎我的表格无效,但我仍然无法找到解决方案.
结果: Ajax响应后,我的res变量无法获取任何数据.
这是我的控制器
public function upload() {
$this->load->helper(array('form', 'url'));
$config['upload_path'] = './uploads/';
$config['image_library'] = 'gd2';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
$token = $this->security->get_csrf_hash();
$data = array();
$res = FALSE;
if (!$this->upload->do_upload('userfile')) {
// $data = $this->upload->data();
$res = FALSE;
} else {
$res = TRUE;
$this->upload->do_upload('userfile');
$data = $this->upload->data();
}
echo json_encode(array('res'=>$res,'img_pro'=>$data,'token'=>$token));
}
Run Code Online (Sandbox Code Playgroud)
这是我的表格
<?php …Run Code Online (Sandbox Code Playgroud) 如何使用CodeIgniter打印在收到的请求的标题中设置的值?
我试过print_r($_SERVER);哪个对我不起作用.我希望使用CI的方式不同.
我正在CodeIgniter 3中做一个项目.我需要index.php从url中删除.为此,我帮助我获取.htaccessCodeIgniter 3的文件以及放置此文件的位置.
这是我的基础
http://cableandmedia.com/demo/
Run Code Online (Sandbox Code Playgroud) 我在Codeigniter项目中有两个应用程序.下面是结构:
/admin
/index.php
/application
/admin
/controllers
/Dashboard
/Product
/Post
/public
/controllers
/Home
/About
/Contact
/system
/index.php
Run Code Online (Sandbox Code Playgroud)
公共应用程序可以正常工作.我可以使用此设置调用所有控制器:
/*----seting in /index.php---*/
$application_folder = 'application/public';
/*----seting in /application/public/config/config.php---*/
$config['base_url'] = 'http://localhost/myweb/';
/*----seting in /application/admin/config/routes.php---*/
$route['default_controller'] = 'Home';
Run Code Online (Sandbox Code Playgroud)
但是,Admin应用程序无法正常工作.我只能调用Dashboard控制器,这是我设置的默认控制器.设置看起来像这样:
/*----setting in /admin/index.php---*/
$application_folder = '../application/admin';
/*----seting in /application/admin/config/config.php---*/
$config['base_url'] = 'http://localhost/myweb/admin/';
/*----seting in /application/admin/config/routes.php---*/
$route['default_controller'] = 'Dashboard';
Run Code Online (Sandbox Code Playgroud)
所以,当我访问时:
http://localhost/myweb/ //it will return home page
http://localhost/myweb/admin //it will return dashboard page
http://localhost/myweb/admin/product //it will return error
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮我解决这个案子吗?
我正在尝试使用get_meta_tags函数来获取url的元信息.它没有给我来自同一起源或域的url元信息.
就像我从控制器http://example.com/fetch那样做
$tags=get_meta_tags("http://example.com/blog/my-awesome-blog-post");
print_r($tags);
Run Code Online (Sandbox Code Playgroud)
试图在我的网站上获取页面的metainfo http://example.com/blog/my-awesome-blog-post.分享两个截图:
本地实例:
获得错误,例如无法打开流:达到重定向限制,中止.这是我得到的错误.
我试过不同的网址(Facebook除外).我获得了成功的结果.
无论如何我可以实现这个功能.
将CI 2.x中的项目迁移到3.x后,显示以下错误,其中我使用了mongo db,这在codeigniter版本2中工作正常,
消息:无法解析MongoDB URI:'mongodb://'.URI中的主机字符串无效.
Db配置
// Generally will be localhost if you're querying from the machine that Mongo is installed on
$config['mongo_host'] = "localhost";
//$config['mongo_host'] = "xxxxxxxxx.compute.amazonaws.com";
// Generally will be 27017 unless you've configured Mongo otherwise
$config['mongo_port'] = 27017;
// The database you want to work from (required)
$config['mongo_db'] = "test_p1";
// Leave blank if Mongo is not running in auth mode
$config['mongo_user'] = "";
$config['mongo_pass'] = "";
// Persistant connections
$config['mongo_persist'] = TRUE;
$config['mongo_persist_key'] = 'ci_mongo_persist';
// …Run Code Online (Sandbox Code Playgroud) codeigniter-3 ×10
php ×9
codeigniter ×5
.htaccess ×1
ajax ×1
frameworks ×1
jquery ×1
login ×1
login-script ×1
mongodb ×1
routing ×1