如何调用另一个php文件到Codeigniter视图 [英] how call another php file to Codeigniter view

查看:192
本文介绍了如何调用另一个php文件到Codeigniter视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在文件夹

我的文件夹结构是

cart.php

我的代码是

$tpl_file ='../mail.php';//problem is here LINE 279
$msg_tmpl = file_get_contents($tpl_file);
if (!file_exists($tpl_file))
   {
?>
   <script>
     alert('no');
   </script>
<?php
   }
   else
   {
   ?>
      <script>
         alert('yes');
      </script>
   <?php
 }

所以我的问题是来自 mail.php 的所有数据并分配 $ tpl_file

So my question is I want to get all data from the mail.php and assign it $tpl_file.

在上述尝试中,我总是使用

In above try I'm getting always NO with


遇到PHP错误

A PHP Error was encountered

严重性:警告

讯息:file_get_contents .php):无法打开流:无此文件或目录

Message: file_get_contents(../mail.php): failed to open stream: No such file or directory

文件名:pages / cart.php

Filename: pages/cart.php

行号:279

推荐答案

任何想法

更改

$tpl_file ='../mail.php';

$tpl_file ='application/views/pages/mail.php';

注意
从您的屏幕截图中, mail.php 位于 application / views / pages / mail.php

这篇关于如何调用另一个php文件到Codeigniter视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆