Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用href链接转到codeigniter中的其他页面_Php_Codeigniter - Fatal编程技术网

Php 如何使用href链接转到codeigniter中的其他页面

Php 如何使用href链接转到codeigniter中的其他页面,php,codeigniter,Php,Codeigniter,在我的项目中有一个名为Welcome的控制器,其中有两个函数,一个是加载主页interior的index,另一个是加载architect页面的architect <a class="catname activecat" href= "<?php echo base_url(''); ?>">Interior</a> <a class="catname" href="<?php echo site_url('welcome/arch

在我的项目中有一个名为Welcome的控制器,其中有两个函数,一个是加载主页interior的index,另一个是加载architect页面的architect

<a class="catname activecat" href= "<?php echo base_url(''); ?>">Interior</a> 

       <a class="catname" href="<?php echo site_url('welcome/architect'); ?>">Architect</a>
在config.php中,$config['base_url']='127.0.0.0/newbluemasons/'; 在routes.php中,$route['default_controller']='welcome'; 试试这个,我已经做了一些实验

<a href="<?php echo base_url().'/' ?>">Interior</a>
<a href="<?php echo base_url().'index.php/architect' ?>">Architect</a>
我认为你的访问是个问题

Steps To Remove index.php using .htaccess:-

Step:-1  Open the file config.php located in application/config path.  Find and Replace the below code in config.php  file.

//  Find the below code

$config['index_page'] = "index.php"

//  Remove index.php

$config['index_page'] = ""
Step:-2  Go to your CodeIgniter folder and create .htaccess  file.


 Path:

Your_website_folder/
application/
assets/
system/
user_guide/
.htaccess <--------- this file
index.php
license.txt
Step:-3  Write below code in .htaccess file

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Step:-4  In some cases the default setting for uri_protocol does not work properly. To solve this issue just open the file config.php located in application/config and then find and replace the code as:

//  Find the below code

$config['uri_protocol'] = "AUTO"

//  Replace it as

$config['uri_protocol'] = "REQUEST_URI" 
试试这个

.htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
HTML:

控制器功能

public function aboutus()
{
    $this->load->view('about');
}
创建about.php


希望这对你有帮助

我现在在内部页面上,希望通过单击内部页面上的链接转到architect页面。我已将配置文件中的基本url设置为$config['base_url']=;但它仍然不起作用。如果您尝试在浏览器127.0.0.1/newbluemasons/welcome/architect中直接调用,该怎么办?这样行吗?不行,即使我直接打电话也不行。但是如果我改变$route['default_controller']='welcome';对于新的控制器,即架构师控制器,它可以工作。将默认的_控制器设置为“欢迎”,尝试或?检查您的链接是否工作。您将使用htaccess删除index.php,然后检查您的htaccess,这就是问题所在。好的,现在转到下一页,但它没有使用css,即页面完全扭曲。
Steps To Remove index.php using .htaccess:-

Step:-1  Open the file config.php located in application/config path.  Find and Replace the below code in config.php  file.

//  Find the below code

$config['index_page'] = "index.php"

//  Remove index.php

$config['index_page'] = ""
Step:-2  Go to your CodeIgniter folder and create .htaccess  file.


 Path:

Your_website_folder/
application/
assets/
system/
user_guide/
.htaccess <--------- this file
index.php
license.txt
Step:-3  Write below code in .htaccess file

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Step:-4  In some cases the default setting for uri_protocol does not work properly. To solve this issue just open the file config.php located in application/config and then find and replace the code as:

//  Find the below code

$config['uri_protocol'] = "AUTO"

//  Replace it as

$config['uri_protocol'] = "REQUEST_URI" 
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
<a href="<?php echo site_url('about-us'); ?>" 
$route['about-us'] = "welcome/aboutus";
public function aboutus()
{
    $this->load->view('about');
}