codeigniter-3

Remove index.php from url in CodeIgniter 3

微笑、不失礼 提交于 2019-11-29 03:59:53
问题 I am doing a project in CodeIgniter 3. I need to remove index.php from url. For that help me to get .htaccess file for CodeIgniter 3 and also where to place this file. This is my baseurl http://cableandmedia.com/demo/ 回答1: Update your htaccess file with the below code RewriteEngine On RewriteBase /demo RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] and in config file, please change base url with below code:- $root = "http://".$

CodeIgniter3: Why would $_SERVER['CI_ENV'] ever be set in the first place?

北战南征 提交于 2019-11-29 00:42:45
问题 I see that in their default installation, their index.php has this: define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); Why would CI_ENV ever already be set within the $_SERVER array? 回答1: As Oliver described; it's a special-use case for multiple environments. Splitting out the development, testing & production by means of .htaccess before it even gets to the code. To configure this: Development (Localhost) <IfModule mod_env.c> SetEnv CI_ENV development <

How to install Doctrine in CodeIgniter 3

会有一股神秘感。 提交于 2019-11-28 21:41:34
The official guide is not complete, and others are for CI2. So i give you a tutorial i myself checked is working. I know SO encourage users to answer their own questions . Luca Mori Polpettini Install Doctrine (The following instructions are modified from: Doctrine 2 ORM’s documentation - Installation and Configuration ) Doctrine can be installed with Composer : From your command line (e.g. Windows: Start > cmd), change to the folder where the files should be installed (e.g. htdocs/my_project). Use Composer to install the files: a. run C:\>composer install doctrine/orm or: b. Define the

Codeigniter 3.x Authentication Library?

你。 提交于 2019-11-28 17:26:04
With the new Codeigniter 3.0 version what authentication libraries do you use? Flexi auth was very good and robust with great documentation for CI 2.0 but it is old and as I can see it is discontinued. Of course it does not work out of the box with CI 3.0. I have tested it and tried to migrate it to CI 3.0 but as it uses the old ci_sessions schema I have seen that it has a lot work to be made to rewrite all the code parts that use sessions. It seems to work with file sessions and some alterations on its code though. Community auth has a CI 3.0 version but as I have seen, it has many bugs and

fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known

女生的网名这么多〃 提交于 2019-11-28 14:19:10
I am failing to send form contents to email. I am getting the following error: : Warning Message: fsockopen(): php_network_getaddresses: getaddrinfo failed:Name or service not known Filename: libraries/Email.php Line Number: 1986 Severity: Warning Message: fsockopen(): unable to connect to ssl://smtp.123mailsetup.com:25 (php_network_getaddresses: getaddrinfo failed: Name or service not known) Filename: libraries/Email.php Line Number: 1986 My line 1986 is $this->smtp_timeout); Part of the code in my controller $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'smtp.xxxx.com', 'smtp_port' =

File Upload Validation In Codeigniter

你。 提交于 2019-11-28 12:14:35
I am trying to validate file upload for image uploading, but it is not getting the validation like other fields. I am using Form_Validation.php process for validation. Image uploading array: array( 'field'=>'image', 'label' => 'Image', 'rules' => 'required' ) when i try to upload the image it did not response like it is required etc. I also want to validate it for .jpg etc and "how to set the file value on incorrect file like instead of .jpg we try to upload the .pdf " like we set the value of input field set_value('field name') etc. I checked a lot of questions and also try to use call method

How to remove single quotes in prepare statement?

天涯浪子 提交于 2019-11-28 11:39:17
问题 My query is like this : $group_id = $session['group_id']; $sql = "SELECT * FROM notification WHERE group_id IN(?)"; $result = $this->db->query($sql, array($group_id))->result_array(); When I add : echo $this->db->last_query();die(); , the result is like this : SELECT * FROM notification WHERE group_id IN('1,13,2') I want remove single quotes in order to the result is like this : SELECT * FROM notification WHERE group_id IN(1,13,2) How to remove single quotes in prepare statement? 回答1: You

default controller inside subfolder codeigniter 3 not working

谁都会走 提交于 2019-11-28 11:33:22
In codeigniter 3 application i have directory structure like this: -Myproject -application -controllers -home Welcome.php //This is my controller inside home directory How to set Welcome controller as default controller? I use below code $route['default_controller'] = 'home/Welcome'; This routing works for previous versions of codeigniter. By default, you are not allowed to do that. To get around this, you need to hack your system Router.php : codeigniter/system/core/Router.php Edit a few lines of code so that it becomes like this: line 1. if (!sscanf($this->default_controller, '%[^/]/%[^/]/%s

Dynamic input field values are not calculating the with the right value

人走茶凉 提交于 2019-11-28 11:32:26
问题 I am using Codeignator. My HTML output which is correct for me. Now What I am doing is, the user will enter the name of the medication, no of pills and amount so that based on the amount it will calculate the price and display it. Formula is $single_price=$total_amount/$qty_number; Above image I added medication name="SIPLA", no of pills=3 and amount=30 . It will calculate it and display the single price=10.00 Everything is working perfectly til now. Let's talk about the "ADD" button. If any

How I can set a session in codeigniter 3 database?

China☆狼群 提交于 2019-11-28 08:27:27
I'm using the new version(3.0.0). of CodeIgniter and I have a new problem, my sessions doesn't work. I mean, the code in the controller is correct because there are not errors but, when I try to print a PHP variable in a view there is nothing. I checked my table in the MySQL Server, and nothing, I don't now what is the problem. I put my code of config.php. (I don't understand a lot of things in this new version) $config['sess_table_name'] = 'ci_sessions'; $config['sess_driver'] = 'database'; $config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 7200; $config['sess_save_path'