I copied some lib files into the vendors directory开发者_StackOverflow of CakePHP. And used App::import
to import the provided lib files.
I can initialize the Classes defined in the lib files, which means I've imported the files successfully. However, the global variables defined in the lib files cannot be used in the controller. As the notice says, the variables are undefined.
How would I access the variables in the lib files from the controller?
It's bad practice to just stick global variables into a file like that and trying to include them.
You should abstract the variables out to a class, or find a way around them all together.
精彩评论