国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

thinkphp - What is the difference between "\" and "\\" when splicing paths in php?
迷茫
迷茫 2017-05-31 10:33:52
0
1
958

I looked at the source code of thinkphp3.2 today and found that the connect method in Thinkphp/Library/Think/Storage.class.php is a bit confusing. The code is:

/**
 * 連接分布式文件系統(tǒng)
 * @access public
 * @param string $type 文件類型
 * @param array $options  配置數(shù)組
 * @return void
 */
static public function connect($type='File',$options=array()) {
    $class  =   'Think\Storage\Driver\'.ucwords($type);
    self::$handler = new $class($options);
}

Why does the path in $class need "\\" instead of "\\"? The last "\\" is to convert "'" single quotes, which is understandable, but the first two "\\" are not That's very understandable, because in my memory it seems that it is possible to use "\" directly, and here, no error is reported when changing "\\" to "\". I think it may be for some better or safer considerations. , or for use in __autoload() later, but specifically why "\\" should be written, I hope any brother knows, let me know, thank you!

迷茫
迷茫

業(yè)精于勤,荒于嬉;行成于思,毀于隨。

reply all(1)
巴扎黑

Simply put, it is more rigorous to use \ to avoid problems that may arise when using alone. In actual production, as long as there is no escaping problem, the specific writing is the same, but the premise is that you are very sure of your code. If you are not sure, writing \ is a more reliable solution.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template