有params和php realpath的道路

时间:2015-05-26 19:49:27

标签: php twitter-bootstrap merge params realpath

在合并几个css期间需要将相对路径转换为绝对路径。

其中一个步骤 - 获得真实路径。

Bootstrap及其css:

@font-face {
  font-family: 'Glyphicons Halflings';
  src: url('../fonts/glyphicons-halflings-regular.eot');
  src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),
       url('../fonts/glyphicons-halflings-regular.woff') format('woff'),
       url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'),
       url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}

realpath 后的结果:

@font-face {
    font-family: "Glyphicons Halflings";
    src: url("/somepath/fonts/glyphicons-halflings-regular.eot");
    src: url("") format("embedded-opentype"),
         url("/somepath/fonts/glyphicons-halflings-regular.woff") format("woff"),
         url("/somepath/fonts/glyphicons-halflings-regular.ttf") format("truetype"),
         url("") format("svg");
}

对于带有参数的路径 false

如何使用参数和保存参数来获取路径的真实路径?

1 个答案:

答案 0 :(得分:0)

你的意思是php" realpath" ? 如果是这种情况,则不应在网址上使用,而是在文件系统路径上使用。

如果要为字体使用绝对路径,则应以" /"开头。 ie:url(" /css/fonts/glyphicons-whateveryoulike.ttf")

" /"在开头将是您的网络目录的根目录。