简体   繁体   English

如何在CakePHP 1.3文件夹结构中包含名为“files”的目录中的php文件?

[英]How to include a php file from directory named “files” in CakePHP 1.3 folder structure?

I have CakePHP 1.3 setup like following app -config -controllers -lib -models -views -webroot -css -files -js 我有CakePHP 1.3设置,如下面的app -config -controllers -lib -models -views -webroot -css -files -js

Now to include a javascript file in my view file(.ctp) I know that i have to do 现在要在我的视图文件(.ctp)中包含一个javascript文件,我知道我必须这样做

echo $this->Html->script('manage_products');

and it will include it but if i want to include any php file from the files directory which is under webroot folder is there any cakePHP method or helper i can use or do i just require_once? 并且它将包括它,但如果我想包括webroot文件夹下的文件目录中的任何php文件是否有任何cakePHP方法或帮助我可以使用或做我只需require_once?

If the PHP file is independent of CakePHP then just use require_once :- 如果PHP文件独立于CakePHP,那么只需使用require_once : -

<?php require_once WWW_ROOT . DS . 'files' . DS . 'foobar.php'; ?>

There is no need to complicate it further than that. 没有必要进一步使它复杂化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM