Xiaopei's DokuWiki

These are the good times in your life,
so put on a smile and it'll be alright

User Tools

Site Tools


it:general

通用方法

程序中目录变量结尾要不要加''/''?

如果变量名是*_path, 就不应加/了, 因为可以这样用:

$store_file = "$store_path/$file_id";

&& At least on the OSes I commonly use, doubling the slash causes no problems, while omitting the slash causes big ones. It is, therefore, safest to both put the slash into the variable and use “$path/$file” when making use of it.

Should a directory path variable end with a trailing slash?

it/general.txt · Last modified: 2013/08/19 07:22 (external edit)