codeigniter

CodeIgniter Check the connection to multi databases take long time

爷,独闯天下 提交于 2020-01-21 20:24:18
问题 I try to connect to multi MySQL database in CI if the connection to the first DB fails, I try to connect to the second, I use this code from CI forum: http://ellislab.com/forums/viewthread/224522/#1030449 $db_obj = $this->database->load('xxx',TRUE); $connected = $db_obj->initialize(); if (!$connected) { $db_obj = $this->database->load('yyy',TRUE); } it works fine on local host, it tries to connect to 1st DB and fails, then directly connect to the 2nd DB (without any long time -- transparency)

Redirect index.php in CodeIgniter

房东的猫 提交于 2020-01-21 12:10:09
问题 I created a CodeIgniter application and now I'm trying to redirect the urls with index.php to urls without it. My current .htaccess is: RewriteEngine On RewriteBase / # Removes trailing slashes (prevents SEO duplicate content issues) RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ $1 [L,R=301] # Enforce www # If you have subdomains, you can add them to # the list using the "|" (OR) regex operator RewriteCond %{HTTP_HOST} !^(www|subdomain) [NC] RewriteRule ^(.*)$ http://www.plugb.com/

Naming convention issues when using codeigniter in windows and linux

蹲街弑〆低调 提交于 2020-01-21 10:15:21
问题 I have made a web application in codeigniter framework. I was developing the app on a Windows machine and the final version runs perfectly well on the same (i.e windows, wamp to be precise ). Now i need to deploy the app on a ubuntu server. After the initial login required in the app, it does not display any other page.On inspecting the console, I found this [09:08:37.255] GET http://localhost/sac.org/index.php/member [HTTP/1.0 500 Internal Server Error 17ms] I think this is a very common

Loading multiple views using codeigniter php

浪子不回头ぞ 提交于 2020-01-21 10:07:04
问题 I have 4 pages in view such as layout/header.php, layout/header_assets.php, user/main.php, layout/footer.php i want to load these multiple view so i have used this code in controller $this->load->view('layout/header_assets'); $this->load->view('user/main',$data); $this->load->view('layout/footer'); but i have got an issue : <link rel="apple-touch-icon" href="http://localhost/game/assets/images/apple-touch-icon.png"> <html lang="en"> <head> </head> <body> test </body> </html> <footer> </footer

Codeigniter, blank page, no errors [closed]

核能气质少年 提交于 2020-01-21 05:49:04
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . public function newreg() { $username = $this->input->post('username'); $password = $this->input->post('password'); $this->load->model('register_model'); $data['list']=$this->register_model->add($username,

008.CI4框架CodeIgniter, Controller控制器传输参数到View视图

核能气质少年 提交于 2020-01-20 17:56:26
01. 在CI4中输出VIEW视图,并且传入参数,代码如下: <?php namespace App\Controllers; class Home extends BaseController { //http://127.0.0.1/CI4/public/ //http://127.0.0.1/CI4/public/index.php/home public function index() { $Login_model = new \App\Models\System\Login_model(); $m_Arr = array( 'MINUTE' => MINUTE, 'HOUR' => HOUR, 'DAY' => DAY, ); //显示数据 echo view('hello', $m_Arr); } //-------------------------------------------------------------------- } 02.VIEW视图文件如下: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>标题</title> </head> <body> <label> <?php echo $MINUTE . '<br>'; echo $HOUR . '<br>

What is a slug?

冷暖自知 提交于 2020-01-20 10:45:10
问题 I'm currently working through CodeIgniters tutorial in its fantastic documentation. However there is a term that is frequently used and it's called a "slug". I've looked around a lot to find out what the term means and I can't make sense of what it is and what it's for. Here's an example of when it's used: With this code you can perform two different queries. You can get all news records, or get a news item by its slug 回答1: A slug is a part of the URL when you are accessing a resource. Say

Fatal error: Call to undefined function form_open() in c

谁都会走 提交于 2020-01-20 04:39:10
问题 i got this error and daunt know where i went wrong i am new to codeigniter so i am sure its something stupid can anyone figure this out tnx in advance. create_view.php <body> <?php echo form_open('create'); ?> <ul id="accordion"> <li> <a>Survey Creation</a> <ul id="survay"> <li>Enter a question:<?php echo form_input('Question')?></li> <li>Answer A: <?php echo form_input('qA' );?></li> <li>Answer B: <?php echo form_input('qB' );?></li> <li>Answer C: <?php echo form_input('qC' );?></li> <li><

The word “Array” gets printed instead of the values of the rows

吃可爱长大的小学妹 提交于 2020-01-19 17:16:13
问题 Okay,i'm a newbie to CI and MySQL. This is my code: <?php class Trail2 extends CI_Controller{ public function boo() { $this->load->database(); $this->load->helper('html'); $ret="SELECT * from posts"; $query=$this->db->query($ret); foreach($query->result_array() as $row) { echo br(1); echo $row; } } } ?> and this returns the word "Array" in place of the values of the rows. I cant seem to figure out why though. Thanks in advance. :) 回答1: use var_dump($row); instead of echo $row; and if you just

API - Error 202 “Your credentials do not allow access to this resource”

社会主义新天地 提交于 2020-01-19 16:22:26
问题 I am trying to use account/verify_credentials and statuses/update API. I always get an error 202 , please see error returned below: {"errors":[{"code":220,"message":"Your credentials do not allow access to this resource."}]} 回答1: Double check your code - it looks like, that you're calling the Twitter REST API with an application-token, instead of an user-token. Have a look here: https://dev.twitter.com/docs/auth/application-only-auth To be able to successfully creating a new status for an