如何包括一个文件,在Codeigniter子目录内4视图

hmae6n7t  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(92)

我想要一个文件。我知道我可以包括一个文件,如果该文件是在同一个目录,例如

.
├── about.php
├── admin
│   ├── customer.php
│   ├── detailorder.php
│   ├── footer.php
│   ├── header.php
│   ├── index.php
│   ├── inventory.php
│   ├── laporan
│   │   ├── inventory.php
│   │   ├── omset.php
│   │   ├── pembatalan.php
│   │   ├── penjualan.php
│   │   ├── produksi.php
│   │   └── profit.php
│   ├── login.php
├── checkout.php
├── detail_produk.php
├── footer.php
├── header.php
├── index.php
└── welcome_message.php

上述树目录位于CI4项目的Views文件夹中。我可以从index.php文件中包含header.php文件,也可以从admin/customer.php中包含header.php文件,因为header.php文件与要包含的文件位于同一目录中。
但是,如何将admin/header.php中的header.php文件包含到admin/laporan/inventory.php中的文件
我试过../header.php../admin/header.php,但它不工作

0h4hbjxa

0h4hbjxa1#

提供基于Views文件夹的完整路径,如下所示:

<?= $this->include('admin/header.php') ?>

相关问题