Php 如何在codeigniter中调用Vew中的函数?

Php 如何在codeigniter中调用Vew中的函数?,php,codeigniter,iframe,Php,Codeigniter,Iframe,这是我的索引视图文件,但如果框架工作不正常,请告诉我,我可以提供哪个源 <iframe width="100%" scrolling="no" height="100%" frameborder="0" align="top" src="index.php/home/slider"></iframe> 这是我的家。phphome是您的类名,首先尝试使用.htaccess删除index.php,您的url应该如下所示 <?php class Home exten

这是我的索引视图文件,但如果框架工作不正常,请告诉我,我可以提供哪个源

<iframe width="100%" scrolling="no" height="100%" frameborder="0" align="top" src="index.php/home/slider"></iframe>


这是我的家。php

home是您的类名,首先尝试使用.htaccess删除index.php,您的url应该如下所示

<?php
class Home extends CI_Controller {

    function index()
    {       $this->load->helper('url');
            $this->load->view('index');
    }

    function slider()
    {   
            $this->load->view('slider');      
    }
}?>
src=“”
删除index.php在.htaccess中使用此代码

src="<?php echo site_url('home/slider'); ?>"

重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?/$1[L]
在源代码中使用(src)

例如:-

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

当您使用site_url时,无需担心htaccess或index.php
site_url('home/slider');