我正在尝试使我的JSON POST请求正常工作,当我将其设置为表单编码请求时,我可以显示所有?args=values&args=values,$this->response($this->post(),200);但是当我将id更改为json编码的POST输入时,我得到了响应[]- 为什么会这样?
我正在将Codeigniter和Tank Auth用于电子商务网站.我发现,如果客户将物品放入购物车(使用内置购物车类的Codeigniter),然后在网站上注册,会话就会与购物车一起丢失(我认为它会因某种原因而生成新的会话保持相同的会议).
有没有人遇到过这个问题?是否有一个我忽略的简单解决方案.
谢谢
我试图从表中获取codeigniter的最大值,但它不起作用.这是我得到的错误:
严重程度:4096
消息:类CI_DB_mysql_result的对象无法转换为字符串
文件名:database/DB_active_rec.php
行号:427
这是我的功能:
public function getPeriodeNummer($bedrijf_id) {
$this->db->select_max('id');
$this->db->where('bedrijf_id', $bedrijf_id);
$result = $this->db->get('rapporten');
$this->db->select('periode_nummer');
$this->db->where('rapporten_id', $result);
$query = $this->db->get('statistieken_onderhoud');
$data = $query + 1;
return $data;
}
Run Code Online (Sandbox Code Playgroud)
我想要做的是如下:
idwhere bedrijf_id= $bedrijf_idfrom rapporten.periode_nummerfrom = statistieken_onderhoudwhere rapporten_id= id我从步骤1获得的最高值.periode_nummer我从步骤2得到的return那个号码.在此感谢您的帮助!
我有重置用户密码的类.但代码总是给我一个错误:
Fatal error: Call to undefined function newRandomPwd() in
C:\AppServ\www\phonebook\application\controllers\reset.php
on line 32
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
class Reset extends CI_Controller{
function index(){
$this->load->view('reset_password');
}
function newRandomPwd(){
$length = 6;
$characters = 'ABCDEF12345GHIJK6789LMN$%@#&';
$string = '';
for ($p = 0; $p < $length; $p++) {
$string .= $characters[mt_rand(0, strlen($characters))];
}
return $string;
}
function resetPwd(){
$newPwd = newRandomPwd(); //line 32, newRandomPwd()
//is undefined
$this->load->library('form_validation');
$this->load->model('user_model');
$getUser = $this->user_model->getUserLogin();
if($getUser)
{
$this->user_model->resetPassword($newPwd);
return TRUE;
} else {
if($this->form_validation->run()==FALSE)
{
$this->form_validation->set_message('','invalid username');
$this->index();
return FALSE; …Run Code Online (Sandbox Code Playgroud) 我有一个小的codeigniter控制器.下面是代码
class Example extends CI_Controller {
/*
* Constructor function
*/
function __construct() {
parent::__construct();
$data['extraScripts'] = 'test'; //Use to add extra scripts in head
}
function function1() {
$this->load->view('v1',$data);
}
function function2() {
$data['extraScripts'] = 'extraScript Veriable override here';
$this->load->view('v2',$data);
}
Run Code Online (Sandbox Code Playgroud)
我想要的是$data['extraScripts'] 在Controller的构造函数中定义一个可验证的,并且默认情况下希望在该控制器的每个方法中都是可验证的.我的意思是在函数f1中我没有创建extraScripts变量但它的视图应该从构造函数(或从任何其他方法)获取值,并且不应该给我undefine变量错误.在第二个函数f2中,我覆盖了extraScript变量,因此它的视图应该显示覆盖的文本.那可能吗.
我有一个视图,header.php,它被加载到各种控制器方法中.它包含我的开始html标记,我的相对链接的基本标记,以及我在应用程序的每个页面中调用的一些元标记.有没有办法来加载渲染meta标签和基本的URL,使它们可用于header.php中每一个它而不必包括加载时的助手$this->load->helper('html');和$this->load->helper('url');我每次$this->load->view('templates/header', $data);在控制器加载的header.php?
我的控制器功能
function test($start_from = 0)
{
$this->load->library('pagination');
$data = array();
$per_page = 3;
$total = $this->activity_model->count_by();
$config['base_url'] = base_url() . 'test';
$config['total_rows'] = $total;
$config['per_page'] = $per_page;
$config['uri_segment'] = 2;
$config['num_links'] = 2;
$config['use_page_numbers'] = TRUE;
$data['follow'] = $this->activity_model->get($per_page, $start_from);
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();
$this->load->view('front_end/test' ,$data);
}
Run Code Online (Sandbox Code Playgroud)
我的路线:
$route['test'] = "user_activity/test";
$route['test/(:any)'] = "user_activity/test/$1";
Run Code Online (Sandbox Code Playgroud)
型号:
function get($limit,$start_from)
{
$sql = "SELECT * FROM user_follow LIMIT $start_from, $limit";
$query = $this->db->query($sql);
return $query->result_array();
}
Run Code Online (Sandbox Code Playgroud)
问题是我有分页1,2,3,4,5 ....并且在每个页面中我显示3个项目.我想在url中显示我的页码1,2,3,4,5
当我点击第二页url show 3当我点击第三页url show 6等等+3时 …
我有一个系统,用户可以在其中将购买的域名输入到他们的个人资料中,因此在访问其域名时,它应该替换其自定义域名,例如
http://domain.com/custom-name到http://purchaseddomain.com。
因此,当他们访问其购买域时,应将其带到其个人资料,包括其导航链接,例如页面上的链接将被其购买域替换,例如查看其记录将是:
http://domain.com/custom-name/records到http://purchaseddomain.com/records。
Tumblr启用了此功能,但是我不知道这一切如何工作:

我一直在搜索SO,这正是我希望拥有这样的功能的方法,但是它似乎没有帮助。
现在这是一个问题,我不确定如何使用PHP可以毫无疑问地验证,确认并将其购买的域合并到服务器中-我正在使用Codeigniter。
是否有扎实,稳定的插件/库或详细教程,可以启用对内部域进行屏蔽的自定义域?
我的服务器在nginx 1.0.6上运行Ubuntu 11.10。
模板对我来说很好,我可以做-我需要帮助的是如何安全地接受并将其域合并到我的服务器。
编辑:只是看着nginx VirtualHostExample,整体上看起来不错,但是当域中有A指向我的服务器的记录时,我如何能够动态地添加/删除这些域条目?
我正在尝试在生产服务器上设置我的网站,并且基本上在/system/core/CodeIgniter.php中的第291行崩溃:
//instantiate the requested controller
// Mark a start point so we can benchmark the controller
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start');
$CI = new $class();
Run Code Online (Sandbox Code Playgroud)
该类是“ auth”(来自tank_auth库),因此在“ $ CI = new auth();”上崩溃。
它不会产生错误(为什么?),仅显示空白页。所有这些在本地都可以正常工作。
有没有人有类似的问题?
我像这样使用jQuery Image上传http://blueimp.github.com/jQuery-File-Upload/
我得到了缩略图,点击上传按钮后我得到了进度条,但后来得到'SyntaxError:JSON.parse:unexpected character'
查看页面
</body>
</html>
<head>
<meta charset="utf-8">
<title>jQuery File Upload Demo</title>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css">
<link rel="stylesheet" href="http://blueimp.github.com/Bootstrap-Image-Gallery/bootstrap-image-gallery.min.css">
<!--[if lt IE 7]><link rel="stylesheet" href="http://blueimp.github.com/Bootstrap-Image-Gallery/bootstrap-ie6.min.css"><![endif]-->
<link rel="stylesheet" href="http://blueimp.github.com/jQuery-File-Upload/jquery.fileupload-ui.css">
<style type="text/css">body {padding-top: 80px;}</style>
<meta name="description" content="File Upload widget with multiple file selection, drag&drop support, progress bar and preview images for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file …Run Code Online (Sandbox Code Playgroud)