$metaInfo = file_get_contents('assets/php/'.$url[0].'/meta.ini');
$metaInfo = str_ireplace("\n","&",$metaInfo);
在去掉中断标签并用 & 号替换之前,数据看起来像这样:
[Page Information]
pageFile=main.php
pageTitle=Home Page
[Overwrite Meta Tags]
metaDescription=The main page in our website.
metaKeywords=My, Insanely, Awesome, Website
metaAuthor=Jake Andreoli
完成后我得到的数据:
[Page Information] &pageFile=main.php &pageTitle=Home Page &[Overwrite Meta Tags] & &metaDescription=The main page in our website. &metaKeywords=My, Insanely, Awesome, Website &metaAuthor=Jake Andreoli
虽然这几乎是正确的,但它为每个变量增加了额外的空间。实在想不通,谁能帮帮我?