Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试动态创建文章。文章的标题是由名字组成的。有些名字中有重音符号(é、è、ç、...)。
现在我正在这样做:
$title = Title::newFromText($name[0] .' '. $name[1]);
但它在有重音的地方返回 NULL。
如何正确创建标题并在文章中保留口音?
正如 Ilmari Karonen 所说,字符串需要进行 UTF-8 编码。它现在有效:
$title = Title::newFromText(utf8_encode($name[0] .' '. $name[1]));