1, loading static resource path

is greater than the 5.0.4 version can be used directly


__STATIC__ project directory: static directory

__JS__ project directory under the static/js Directory:

__CSS__ project directory project: the static/css directory in

we can use these constants view template print

 < specific path;! DOCTYPE html> < html> < head> < meta charset= "UTF-8" > < title> Insert Title here< /title> /head> < lt; body> __ROOT__< br> __STATIC__< br> __JS__< br> __CSS__< br> < /body> < /html> 


page output is as follows:

 / /projectname/public/static /projectname/public/ static/js /projectname/public/static/css

opens the config file under the application folder, you can customize the resource constant according to your needs, define the post constant to use constants in the template file. For example:

 < PHP return? ['view_replace_str'=> ['../public/static/admin','__ROOT__';'__PUBLIC__'=> =>'__APP__' => '/','app/admin/', 



predefined constants predefined constants indicates that the system is built in the definition of a good constant does not change as the environment changes, including:

EXT typelib file suffix (.Php) path constant

THINK_VERSION Framework version number

3 and

system and the application of constant path for the default directory specification system, can redefine the change, if you do not want the custom directory, these constants generally do not need to change.

 DS the current system directory separator THINK_PATH framework ROOT_PATH system directory framework application root directory APP_PATH application directory (default application) CONF_PATH configuration directory (default APP_PATH) LIB_PATH System Library Directory (default THINK_PATH.'library/') CORE_PATH core class library directory (default LIB_PATH.'think/') TRAIT_PATH system trait directory (default LIB_PATH.'traits/') EXTEND_PATH extension the Library Directory (the default is ROOT_PATH.'extend/') VENDOR_PATH third party Library Directory (the default is ROOT_PATH.'vendor/') RUNTIME_PATH application runtime directory (default ROOT_PATH.'runtime/') LOG_PATH application log directory (default RUNTIME_PATH.'log/') CACHE_PATH project template cache directory (default is RUNTIME_PATH.'cache/') TEMP_PATH application cache directory (default RUNTIME_PATH.'temp/') 

4, system constant

system constants will change as the development environment changes or settings change.

 IS_WIN is Windows IS_CLI is a command line environment THINK_START_TIME running time (time stamp) THINK_START_MEM starts running when the memory footprint of the ENV_PREFIX environment variable configuration prefix 

"" summary of the above method is small to give thinkphp5 loading static resource path and introduce the constant and I hope to help you, if you have any question welcome message to me, Xiao Bian will reply you in time!

This concludes the body part