Home > Backend Development > PHP Tutorial > 这里realpath起啥作用呢

这里realpath起啥作用呢

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-20 12:33:02
Original
1154 people have browsed it

$act_file = realpath(BASE_PATH . '/control/' . $_GET['act'] . '.php');

上面这个写法是在一个方法中,当然作者的目的是引用一个文件的路径,但我不理解的是,为啥加这个realpath呢,当然此函数,手册上说是为了求出绝对路径,可是括号里面的BASE_PATH . '/control/' . $_GET['act'] . '.php',本身就已是绝对路径了,如再加一个realpath,这不是多吃一举吗,当然我的理解也可能不正确,还望专家指正!


回复讨论(解决方案)

是不是多此一举,那要看 BASE_PATH(基准路径)的值是什么了
至少在你给出的信息中,不能判定 BASE_PATH 一定是绝对路径

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template