codeigniter-url

How to route 2 parameters to a controller?

三世轮回 提交于 2019-12-03 16:12:50
问题 This seems really basic but i can't get the hang of it. I'm trying to send more then one parameter to a method in the controller, like this : http://localhost/ci/index.php/subjects/3/state This is the routings i've tried : $route['subjects/(:num)'] = 'subjects/view/$1'; $route['subjects/(:num)/{:any}'] = 'subjects/view/$1/$2'; the method accepted 2 paremeters : public function view($slug, $id = null){ } but i seem to get a 404. How can i get this to work? i need the view method to always

How to route 2 parameters to a controller?

早过忘川 提交于 2019-12-03 05:38:05
This seems really basic but i can't get the hang of it. I'm trying to send more then one parameter to a method in the controller, like this : http://localhost/ci/index.php/subjects/3/state This is the routings i've tried : $route['subjects/(:num)'] = 'subjects/view/$1'; $route['subjects/(:num)/{:any}'] = 'subjects/view/$1/$2'; the method accepted 2 paremeters : public function view($slug, $id = null){ } but i seem to get a 404. How can i get this to work? i need the view method to always accept 1 parameter and optional other parameters. NOTE : I am including the url helper. you have problem

Combine friendly url and query string [closed]

放肆的年华 提交于 2019-12-02 17:38:45
问题 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 . How to make a working url like this: example.com/controller/method?id=1&cat=2 回答1: It is possible by setting $config['enable_query_strings'] = TRUE; in your config.php file (As DamienL answered). I just tried

Remove index.php in CodeIgniter

梦想与她 提交于 2019-12-02 12:38:26
问题 I'm trying to remove the 'index.php' from CI Urls. I've tried many solutions, none of them worked. I've already set these variables in 'config.php': $config['index_page'] = ""; $config['uri_protocol'] = "REQUEST_URI"; And my current .htaccess is: Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^plugb.com$ [NC] RewriteRule ^(.*)$ http://www.plugb.com/$1 [R=301,L] RewriteCond $1 !^(index\.php|files|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %

Codeigniter - redirect [duplicate]

怎甘沉沦 提交于 2019-12-02 11:55:03
问题 This question already has answers here : How to fix “Headers already sent” error in PHP (11 answers) Closed 6 years ago . I have problem redirecting from index to the functions logotyp or tiskoviny . When I write to the browser ( localhost/my_page/sluzby/logotyp ) it works but it show without CSS (this is the second problem). The URL Helper is auto-loaded. class Sluzby extends CI_Controller { public function __construct() { parent::__construct(); $this->load->library('uri'); $this->load-

Use of undefined constant CURLOPT_IPRESOLVE - assumed 'CURLOPT_IPRESOLVE'

寵の児 提交于 2019-12-02 10:12:57
i have http://www.idiotminds.com/login-with-facebook-in-codeigniter/ but i have error > A PHP Error was encountered > > Severity: Notice > > Message: Use of undefined constant CURLOPT_IPRESOLVE - assumed > 'CURLOPT_IPRESOLVE' > > Filename: facebook/base_facebook.php and i fix CURLOPT_SSL_VERIFYPEER => false, but not fixed but i have enable the php_curl ** cURL support enabled cURL Information libcurl/7.24.0 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 ** code public static $CURL_OPTS = array( CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 60, CURLOPT_USERAGENT =>

site_url() is not work properly in codeigniter framework

巧了我就是萌 提交于 2019-12-02 10:06:50
问题 following work not work properly for codeigniter framework... Its my View: <?php echo '<h2>'.$news_item['title'].'</h2>'; echo $news_item['text']."</br></br>"; ?> <a href="<?php site_url("news"); ?>" > Back to Main </a></br></br> 回答1: You should have loaded the url_helper in your controller construct method or in the function that calls your view like this $this->load->helper('url') and then in your view you should echo the site_url() <a href="<?php echo site_url("news"); ?>" > Back to Main <

Combine friendly url and query string [closed]

让人想犯罪 __ 提交于 2019-12-02 08:31:05
How to make a working url like this: example.com/controller/method?id=1&cat=2 Colin Brock It is possible by setting $config['enable_query_strings'] = TRUE; in your config.php file (As DamienL answered). I just tried with a fresh CodeIgniter installation from here . However, it appears there must be at least 2 variables (separated with a "&") for it to work. Here are the steps I took to make this happen: In config.php, I changed $config['base_url'] to the appropriate directory and set $config['enable_query_strings'] = TRUE; In the controllers directory I created the following class: class

site_url() is not work properly in codeigniter framework

为君一笑 提交于 2019-12-02 08:06:03
following work not work properly for codeigniter framework... Its my View: <?php echo '<h2>'.$news_item['title'].'</h2>'; echo $news_item['text']."</br></br>"; ?> <a href="<?php site_url("news"); ?>" > Back to Main </a></br></br> You should have loaded the url_helper in your controller construct method or in the function that calls your view like this $this->load->helper('url') and then in your view you should echo the site_url() <a href="<?php echo site_url("news"); ?>" > Back to Main </a></br></br>` Did u load url helper Did u specify the site_url in config file... ->Returns your site URL,

Remove index.php in CodeIgniter

左心房为你撑大大i 提交于 2019-12-02 07:07:50
I'm trying to remove the 'index.php' from CI Urls. I've tried many solutions, none of them worked. I've already set these variables in 'config.php': $config['index_page'] = ""; $config['uri_protocol'] = "REQUEST_URI"; And my current .htaccess is: Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^plugb.com$ [NC] RewriteRule ^(.*)$ http://www.plugb.com/$1 [R=301,L] RewriteCond $1 !^(index\.php|files|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA] The www prefix part works fine. But the