codeigniter

Codeigniter htaccess not working

强颜欢笑 提交于 2021-02-07 20:34:42
问题 I am using this htaccess file on my site to remove index.php. RewriteEngine on RewriteCond $1 !^(index\.php) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA] But this file doesn't work.Rewriting is enabled in Apache module.Version of codeigniter used is 2.0.1. 回答1: I've tested this without codeigniter, and it works. I create a folder under htdocs, called "demo". I put ".htaccess" there with your content + additional line

How to get current date in codeigniter

耗尽温柔 提交于 2021-02-07 12:48:18
问题 How to get current date in codeigniter in YY-mm-dd format. I wants to get current date in YY-mm-dd frmat and put this value into input text box 回答1: You can use the PHP date function. date('Y-m-d'); Up to my knowledge, there is no separate date function in codeigniter. EDIT : But if you want date in this format 13-04-05 [ yy-mm-dd ] , Try this date('y-m-d'); For more date formats, check this link PHP Date Formats 回答2: Try to use this is a generic format of DateTime echo date('Y-m-d H:i:s');

How to delete cookie on codeigniter

纵然是瞬间 提交于 2021-02-07 12:21:59
问题 I don't know how to delete a cookie. I want is when I submit a form. The cookie is also delete. I try the delete_cookie("name") but is not working. I think because the cookie I created by javascript . Please check my code to fix this problem. This is my sample text field: <input name="cargo_no" type="text" class="validate[required]" id="cargonumber" onchange="setCookie('cargonumberC', this.value, 365);"/> and this is the javascript function setCookie(cookieName, cookieValue, nDays) { var

How to delete cookie on codeigniter

依然范特西╮ 提交于 2021-02-07 12:19:59
问题 I don't know how to delete a cookie. I want is when I submit a form. The cookie is also delete. I try the delete_cookie("name") but is not working. I think because the cookie I created by javascript . Please check my code to fix this problem. This is my sample text field: <input name="cargo_no" type="text" class="validate[required]" id="cargonumber" onchange="setCookie('cargonumberC', this.value, 365);"/> and this is the javascript function setCookie(cookieName, cookieValue, nDays) { var

What is the difference between view and render?

半腔热情 提交于 2021-02-07 10:28:47
问题 What is the difference between view and render in codeigniter? 回答1: some template libraries use $this->template->render(); to output the rendered content based on your template. (you must have the template library installed obviously) function index() { $this->template->set_template('main_template'); $data['content'] = 'hello this is my content'; $this->template->write_view('content', $data); $this->template->render(); } is in effect the same as function index() { $data['content'] = 'hello

how to know whether key exists in Json string [duplicate]

泄露秘密 提交于 2021-02-05 19:49:50
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: How to check if an array element exists? apologize if i am wrong,I am new to PHP, Is there any way to find out whether key exists in Json string after decoding using json_decode function in PHP. $json = {"user_id":"51","password":"abc123fo"}; Brief: $json = {"password":"abc123fo"}; $mydata = json_decode($json,true); user_id = $mydata['user_id']; If json string doesn't consist of user_id,it throws an exception

how to know whether key exists in Json string [duplicate]

大城市里の小女人 提交于 2021-02-05 19:49:17
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: How to check if an array element exists? apologize if i am wrong,I am new to PHP, Is there any way to find out whether key exists in Json string after decoding using json_decode function in PHP. $json = {"user_id":"51","password":"abc123fo"}; Brief: $json = {"password":"abc123fo"}; $mydata = json_decode($json,true); user_id = $mydata['user_id']; If json string doesn't consist of user_id,it throws an exception

how to know whether key exists in Json string [duplicate]

老子叫甜甜 提交于 2021-02-05 19:36:41
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: How to check if an array element exists? apologize if i am wrong,I am new to PHP, Is there any way to find out whether key exists in Json string after decoding using json_decode function in PHP. $json = {"user_id":"51","password":"abc123fo"}; Brief: $json = {"password":"abc123fo"}; $mydata = json_decode($json,true); user_id = $mydata['user_id']; If json string doesn't consist of user_id,it throws an exception

how to hide index.php and controller name in codeigniter by htaccess

感情迁移 提交于 2021-02-05 12:23:31
问题 i want to hide index.php and controller name from my codeignier url website also i want to replace this term ?seo=test-product ad /test-product i have mention my htaccess file below please guild me how to fix this issue i have tried many things none helps RewriteEngine On RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} ^www\. [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301] <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %

how to hide index.php and controller name in codeigniter by htaccess

ぃ、小莉子 提交于 2021-02-05 12:22:09
问题 i want to hide index.php and controller name from my codeignier url website also i want to replace this term ?seo=test-product ad /test-product i have mention my htaccess file below please guild me how to fix this issue i have tried many things none helps RewriteEngine On RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} ^www\. [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301] <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %