超链接和图像不显示
hyperlink and image does't display
我在 xampp 中使用 codeigniter,我的代码中有两个问题
超链接不起作用我尝试了很多不同的方法但都不起作用
<a href="<?php base_url();?> Login_v.php">Log in</a>
图片也不显示
<img src="images/login.jpg" width="150" height="40" />
我认为我的 .htaccess 中有错误
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /helloworld/
# Disable rewrite for valid directory/files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#map all request urls to a specific controller method
RewriteRule ^(.*)$ index.php?/{controller}/{method}/ [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
请任何人帮助我
这应该是
<img src="images/login.jpg" width="150" height="40" />
改成这个
<img src="<?php echo base_url()?>images/login.jpg" width="150" height="40" />
并且加载文件应该link到控制器方法d
<a href="<?php base_url();?> Login_v.php">Log in</a> # Not works
解决方案
<a href="<?php base_url();?>controller_name/function_name">Log in</a>
控制器内部
public function function_name()
{
$this->load->view("login_v");
}
可见
Create/Move Login_v.php
到 application/view
我在 xampp 中使用 codeigniter,我的代码中有两个问题
超链接不起作用我尝试了很多不同的方法但都不起作用
<a href="<?php base_url();?> Login_v.php">Log in</a>
图片也不显示
<img src="images/login.jpg" width="150" height="40" />
我认为我的 .htaccess 中有错误
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /helloworld/
# Disable rewrite for valid directory/files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#map all request urls to a specific controller method
RewriteRule ^(.*)$ index.php?/{controller}/{method}/ [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
请任何人帮助我
这应该是
<img src="images/login.jpg" width="150" height="40" />
改成这个
<img src="<?php echo base_url()?>images/login.jpg" width="150" height="40" />
并且加载文件应该link到控制器方法d
<a href="<?php base_url();?> Login_v.php">Log in</a> # Not works
解决方案
<a href="<?php base_url();?>controller_name/function_name">Log in</a>
控制器内部
public function function_name()
{
$this->load->view("login_v");
}
可见
Create/Move Login_v.php
到 application/view