简体   繁体   中英

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. how can I call the global variables mentioned in my newconfigfile.php in my js file. for example define("DATETIME_FORMAT", "MM/dd/yy HH:mm");

Create a fie in your app/Vendor/newconfigfile.php then paste this line

define("DATETIME_FORMAT", "MM/dd/yy HH:mm");    

Now go to in your app/Config/bootstrap.php

Add the following line

App::import('Vendor', 'newconfigfile');

Now you can call DATETIME_FORMAT as a global variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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