天道酬勤,学无止境

codeigniter-3

Message: Configured database connection is persistent. Aborting

Codeigniter 2 to 3 version after upgrading, I get this error.. Why would that be? An uncaught Exception was encountered Type: Exception Message: Configured database connection is persistent. Aborting. Filename: /var/www/vhosts/xxx.com/app/system/libraries/Session/drivers/Session_database_driver.php Line Number: 94 Backtrace: File: /var/www/vhosts/xxx.com/app/application/core/MY_Controller.php Line: 11 Function: __construct File: /var/www/vhosts/xxx.com/app/application/core/MY_Controller.php Line: 52 Function: __construct File: /var/www/vhosts/xxx.com/app/application/controllers/Dashboard.php

2021-07-13 01:39:03    分类:问答    php   codeigniter   database-connection   codeigniter-3

Need string formation with space in php

$string='to kill a mocking bird'; Need output like below format Output: '"To kill a mocking bird", "Tokill a mocking bird", "Tokilla mocking bird", "Tokillamocking bird", "Tokillamockingbird", ,"To kill a mockingbird" ,"To kill amockingbird" ,"To killamockingbird"'; I used below Script $array = is_string($arg) ? str_split($arg) : $arg; if(1 === count($array)) return $array; $result = array(); foreach($array as $key => $item) foreach(permute(array_diff_key($array, array($key => $item))) as $p) $result[] = $item .' '. $p; return $result;

2021-07-10 15:15:26    分类:问答    php   codeigniter-3

Codeigniter pagination showing duplicate records with page query string

i have created pagination with codeigniter 3. On every page i am getting same results: my final url seems like: http://localhost/shoping/products/mobile-phones?cid=3&page=2 Controller file: public function category(){ $category_id = $this->input->get('cid', TRUE); $slug = $this->uri->segment(2); $sortby = $this->input->get('sort', TRUE); $sorttype= 'ASC'; $limit = 10; $config = array(); $config['base_url'] = base_url() . 'products/'.$slug.'?cid='.$category_id; $config['total_rows'] = $this->Product_model->category_product_count($category_id); $config['per_page'] = $limit; $config['use_page

2021-07-09 18:00:46    分类:问答    php   codeigniter   pagination   codeigniter-3

CodeIgniter 3 - configuring log_threshold

Ok I got confused. Inside application/config.php it says in comments: | If you have enabled error logging, you can set an error threshold to | determine what gets logged. Threshold options are: | You can enable error logging by setting a threshold over zero. The | threshold determines what gets logged. Threshold options are: | | 0 = Disables logging, Error logging TURNED OFF | 1 = Error Messages (including PHP errors) | 2 = Debug Messages | 3 = Informational Messages | 4 = All Messages | | You can also pass an array with threshold levels to show individual error types | | array(2) = Debug

2021-07-02 21:36:40    分类:问答    php   codeigniter   codeigniter-3

Error: while login and logout using codeigniter [duplicate]

This question already has answers here: Codeigniter pressing logout button and disable the back browser button (5 answers) Closed 2 years ago. The login and logout is working fine but, after getting logout from the page im still able to access that page, for example in url if i use as codeigniter_try/index.php/Home/backend its displaying the page which should not happen, i mean to say it should display only when i loggedin with the username and password. what issue im facing here can any one guide me ? This is my Controller.php //-------this is Login method -------- public function login() {

2021-07-02 07:14:20    分类:问答    php   codeigniter   codeigniter-3

Codeigniter email sending is not working [duplicate]

This question already has answers here: PHP mail function doesn't complete sending of e-mail (28 answers) Closed 4 years ago. I'm trying to send an email with an codeigniter contact us form but its not sending the email. Yes I know this question has been asked before but I just want to know if I don't have any wrong code. This is my controller file (Contactform.php) : <?php error_reporting(-1); ini_set('display_errors', 'On'); set_error_handler("var_dump"); error_reporting(E_ALL); ini_set('display_errors', '1'); ?> <?php class Contactform extends CI_Controller { public function __construct() {

2021-06-28 19:31:42    分类:问答    php   codeigniter   email   codeigniter-3

Codeigniter - Access Models And Database on Routing

I'm Planning to make a project in codeigniter 3.0.3 and I want to use routing like below. 1) . www.mydomain.com/categoryNamehere 2) . www.mydomain.com/postNameHere I have a separate table in my database to keep category names with their unique id's. What I want is when a user click on a link like www.mydomain.com/xxxxx 1.first check on category table (xxxxx) 2. if no match send it (xxxxx) to post controller. How can I implement this on Codeigniter 3.0.3 ? I tried to access my models in config / routing.php and also I tried to execute mysql codes (active records) directly in routing page.

2021-06-28 17:15:20    分类:问答    php   mysql   codeigniter   content-management-system   codeigniter-3

cron job return login page html in codeigniter

In my application i need to set cron job for daily updation. I am using CodeIgniter 3.0 My config.php file $config['index_page'] = ''; $config['uri_protocol'] = 'AUTO'; Here is my controller class Cron extends CI_Controller { public function cron_job(){ if (!$this->input->is_cli_request()){ echo 'test'; //show_error('Direct access is not allowed'); } else{ echo 'call'; } } } and i have set path in cpenal like /usr/bin/php /home/public_html/my_app/index.php cron cron_job But this return html of login page which is also front page of app. I think there is issue with path, So how can i fix it?

2021-06-28 08:18:24    分类:问答    php   codeigniter   cron   codeigniter-3

How to submit the dynamical input field into the database?

I am displaying the input field dynamically which is working for me. The issue is, I have to submit the form. I have tried some code as below but it's not working. I am using Codeigniter. Controler code public function register(){ $save = array( 'pp_fileStatus' => $this->input->post('pp_fileStatus'); 'reasonDate' => $this->input->post('reasonDate'); 'reasonAmt' => $this->input->post('reasonAmt'); ); $afterxss=$this->security->xss_clean($save); if ($afterxss) { $this->db->insert('tbl_register',$afterxss); $response['error'] = "true"; $response['msg'] = "Successfully"; }else{ $response['error']

2021-06-27 04:06:16    分类:问答    javascript   php   html   jquery   codeigniter-3

组合具有相同元素值的数组并将它们全部放在一起,逗号分隔(Combine array with same element value and keep them all together, comma separated)

问题 我有一个多维数组 [0] => Array ( [name] => Size [value] => XS,S,XL ) [1] => Array ( [name] => Brand [value] => Adidas ) [2] => Array ( [name] => Size [value] => XS,XL,L,M ) [3] => Array ( [name] => Brand [value] => Nike ) 我想要结果 [0] => Array ( [name] => Size [value] => S,M,L,XS,XL ) [1] => Array ( [name] => Brand [value] => Adidas,Nike ) 我正在尝试array_combine , array_merge甚至array_unique没有成功 回答1 你可以试试这个—— $array = array( '0' => array ( 'name' => 'Size', 'value' => 'XS,S,XL', ), '1' => array ( 'name' => 'Brand', 'value' => 'Adidas', ), '2' => array ( 'name' => 'Size', 'value' => 'XS,XL,L,M', ), '3' =>

2021-06-26 22:40:10    分类:技术分享    php   arrays   multidimensional-array   codeigniter-3