如何在cakephp中使用require_one视图

如何在cakephp中使用require_one视图

问题描述:

i am beginner in cakephp and i want use file with percalname.php in my view.
this file have this path :
app\webroot\files\percalname.php
and i write this code in my view (this code is in line 17)

require_once $this->webroot.'../files/percalname.php';

but i face this message :

require_once(/cake/../files/percalname.php) [function.require-once]: failed to open stream: No such file or directory [APP\views\orders\add.ctp, line 17]

我是cakephp的初学者,我希望在我的视图中使用带有 percalname.php code>的文件 。 这个文件有这个路径:
app \ webroot \ files \ percalname.php code>
我在我的视图中写这段代码(这段代码在线 17) p>

  require_once $ this-> webroot。'.. / files / percalname.php'; 
  code>  pre> 
 
  
 
 

require_once(/ cake /../ files / percalname.php)[function.require-once]:无法打开流 :没有这样的文件或目录[APP \ views \ orders \ add.ctp,第17行] p> blockquote> div>

you can use vondor .
first you should copy file to vendor folder and use app::import() like this link. vendor example in cakephp.org

good luck.