[英]in cakephp how to create another file like core.php file and call global variable in js file
I have created a file inside config folder similar like config.php. 我已经在config文件夹中创建了类似config.php的文件。 how can I call the global variables mentioned in my newconfigfile.php in my js file.
如何在js文件中调用newconfigfile.php中提到的全局变量。 for example define("DATETIME_FORMAT", "MM/dd/yy HH:mm");
例如define(“ DATETIME_FORMAT”,“ MM / dd / yy HH:mm”);
Create a fie in your app/Vendor/newconfigfile.php then paste this line 在您的app / Vendor / newconfigfile.php中创建一个国际剑联,然后粘贴此行
define("DATETIME_FORMAT", "MM/dd/yy HH:mm");
Now go to in your app/Config/bootstrap.php 现在转到您的app / Config / bootstrap.php
Add the following line 添加以下行
App::import('Vendor', 'newconfigfile');
Now you can call DATETIME_FORMAT
as a global variable. 现在,您可以将
DATETIME_FORMAT
称为全局变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.