我正在尝试将我的codeigniter 3网站上传到godaddy,但我不断收到错误消息,例如Session: Configured save path 'C:\Windows\Temp' is not writable by the PHP process..
我已经在这里跟踪了这个问题和codeigniter数据库驱动程序,但到目前为止还没有.
我在我的数据库中创建了一个ci_sessions表,将驱动程序设置为数据库和路径,ci_sessions但我得到了一个致命的错误.我尝试将驱动程序设置为文件和我创建的ci_sessions文件夹的路径,但它找不到但我不确定我是否正确创建了它,我使用过$config['sess_save_path'] = '{{site_path}}/application/ci_sessions';
有谁知道我做错了什么?提前致谢.
UPDATE
好的,所以我开始使用新版本codeigniter 3并将驱动程序设置为数据库和路径ci_sessions并且它可以工作,但是当我使用if(!empty($this->session->userdata("user_id"))它时会导致致命错误,任何想法?
这是我的搜索类型,其代码如下:
<input type="text" required ="required"name="city_code" id="code" autocomplete="off" class="form-control">
Run Code Online (Sandbox Code Playgroud)
这是我试图做的jquery:
function city_value()
{
return '/ajax/get_address_list?city_code='+$('#code').val();
}
$tmp_location={};
$('#code').autocomplete({
serviceUrl:city_value,
minChars:2,
lookupLimit: 25,
focus_suggestion:true,
transformResult: function(response) {
$tmp_location=$.parseJSON(response);
return {
suggestions: $tmp_location
};
}
});
Run Code Online (Sandbox Code Playgroud)
这是我的搜索自动完成类型的控制器:
function get_address_list(){
$post_code= $this->input->get("city_code",true);
$location_list=$this->ajax_m->m_get_address_like($post_code);
echo json_encode($location_list);
}
Run Code Online (Sandbox Code Playgroud)
这是模型:
function m_get_address_like($city_code){
$sql = "SELECT `singapore_address`,`singapore_postal_code`
FROM `uhd_singapore_address`
WHERE `singapore_postal_code`='$city_code%' OR (singapore_address LIKE '$city_code%')";
$query=$this->db->query($sql);
return $query->result_array();
}
Run Code Online (Sandbox Code Playgroud)
我已经使用了firebug进行了检查,我的autocomplete.js中出现了以下错误
Autocomplete.formatResult = function (suggestion, currentValue) {
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
return suggestion.value.replace(new RegExp(pattern, 'gi'), …Run Code Online (Sandbox Code Playgroud) 我希望有漂亮的好看的错误页面.为此,我需要获得一些CSS和JS文件.但由于一些奇怪的原因使用base_url()不起作用的error_pages.我当然可以使用href="/css/style.css"并告诉它从根文件夹中获取它.但是网站很可能放在与根文件夹不同的文件夹中.因此使用/不是一种选择.
所以我现在的问题是为什么不能base_url()在错误页面上工作?我已经自动加载它所以不应该工作吗?
这是我在尝试从视图中的error_404页面获取base_url()时尝试的.
在我的autoload.php中,我已经包含了帮助器 url
$autoload['helper'] = array('url', 'form');
Run Code Online (Sandbox Code Playgroud)
在我的error_404页面(application/views/errors/html/error_404.php)中,我回复了base_url,如下所示:
<?php echo base_url(); ?>
这是我得到的错误:
An uncaught Exception was encountered
Type: Error
Message: Call to undefined function base_url()
Filename: /usr/local/www/example.com/application/views/errors/html/error_404.php
Line Number: 37
Backtrace:
File: /usr/local/www/example.com/index.php
Line: 315
Function: require_once
Run Code Online (Sandbox Code Playgroud)
我不想在system文件夹中进行任何更改,因为每次更新Codeigniter文件夹时我都不想重做该过程.
系统:
Codeigniter 3.0.6
PHP 7.0.8
Nginx 1.11.1
更新: 我想在每个错误页面(db,404,general,php等)上调用base_url.
以下代码给出了一个错误.我想调用一个函数并使用php codeigniter将参数传递给它.
redirect(base_url() . 'MainController/Student_Login($user_email)')
Run Code Online (Sandbox Code Playgroud)
这里MainController是Controller名称,Student_Login是函数$ user_email是一个保存用户电子邮件ID的变量.我也试过通过网址发送它.例如
redirect(base_url() . 'MainController/Student_Login/.$user_email.')
Run Code Online (Sandbox Code Playgroud)
请帮忙.
我最近在我的xampp上设置了一个旧的Codeigniter框架.但是我不知道这个框架的版本.我用的是代码
<?php echo CI_VERSION; ?>
Run Code Online (Sandbox Code Playgroud)
但它给我错误
Notice: Use of undefined constant CI_VERSION - assumed 'CI_VERSION' in /opt/lampp/htdocs/projectname/views/v_header.php on line 57
CI_VERSION
Run Code Online (Sandbox Code Playgroud)
请指导我,我是Codeigniter的新手.
在结账时我调用一个更新数据库出勤率并计算小时数的函数(使用Codeigniter)
public function updateAttendance($data,$id)
{
date_default_timezone_set('Asia/Karachi');
$attendance=array(
'check_in'=> $data['check_in'],
'check_out'=> $data['check_out']
);
$this->db->WHERE('id',$id)->update('attendance',$attendance);
$this->db->query('UPDATE attendance SET hours=(HOUR(TIMEDIFF(check_out,check_in))-1) WHERE DATE(date)=\''.date('Y-m-d').'\' and employee_id='.$id);
return true;
}
Run Code Online (Sandbox Code Playgroud)
我通过员工ID获取我的出勤率,并在员工的个人资料中呈现这样的视图.
问题是我的小时计算错误,可能是由于我的查询.是否有查询修复,或者我必须以时间格式保持时间差异,然后在月末添加所有这些,然后从中获取数小时.
我有以下代码
的index.php
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
.panel{
margin-right: 3px;
}
.button {
background-color: #4CAF50;
border: none;
color: white;
margin-right: 30%;
margin-left: 30%;
text-decoration: none;
display: block;
font-size: 16px;
cursor: pointer;
width:30%;
height:40px;
margin-top: 5px;
}
input[type=text]{
width:100%;
margin-top:5px;
}
.chat_wrapper {
width: 70%;
height:472px;
margin-right: auto;
margin-left: auto;
background: #3B5998;
border: 1px solid #999999;
padding: 10px;
font: 14px 'lucida grande',tahoma,verdana,arial,sans-serif;
}
.chat_wrapper .message_box {
background: #F7F7F7;
height:350px;
overflow: auto;
padding: 10px 10px 20px 10px; …Run Code Online (Sandbox Code Playgroud) 我需要在变量中访问页面URL,并在控制器中找到它.有没有办法找到它?请帮助我.使用以下代码重定向($ this-> agent-> referrer());
我可以重定向到上一页.但我需要在变量内部进行检查.
/etc/nginx/conf.d/default.conf
server{
listen 80;
listen [::]:80;
server_name 192.168.56.101 192.168.101.100 localhost;
root /var/www/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Run Code Online (Sandbox Code Playgroud)
我的codeigniter文件夹位于/ var / www / html / ci中的'ci',我需要什么配置来进行URL重写?...