我使用DOMDocument编辑一些HTML文件,但是一些主题在其名称空间中.所以DOMDocument自动将空格更改为%20,然后找不到它们.
这就是如何准确查看错误:
Warning: DOMDocument::load() [domdocument.load]: Entity 'nbsp' not defined in file:///C:/Path/To/The/File/01%20c%2040-1964.html, line: 11 in C:/Path/To/class.php on line 51
Run Code Online (Sandbox Code Playgroud)
你知道如何修复这个错误吗?
提前感谢您的回答
我创建了一个应用程序,它使用类ZipArchive(php中的标准)中的方法extractTo(),我在Windows 7上的localhost apache服务器上测试它没有任何问题.但是在我在一些unix生产服务器上尝试之后,它就抛出了
Warning: ZipArchive::extractTo(): Permission denied in /path/to/file.php on line 27
Run Code Online (Sandbox Code Playgroud)
我甚至在0777上为应用程序使用的每个文件夹设置了chmod,但它没有帮助.
你知道什么是错的吗?
我需要在PHP中使用DOM为XML文件添加一个自动关闭标记,但我不知道如何,因为标准地说,这个标记看起来像这样:
<tag></tag>
Run Code Online (Sandbox Code Playgroud)
但它应该是这样的:
<tag/>
Run Code Online (Sandbox Code Playgroud) 我有一个文件夹,其中有一些文件和子文件夹.例如,我需要返回具有给定扩展名的文件名或相对地址(如果文件位于子文件夹中).html.
例如,这是给定文件夹的结构:
所以代码应该返回(理想情况下在数组中):
它只是用.html扩展名拉出名字,但我真的不知道如何解决这个问题.
php ×5
dom ×2
directory ×1
domdocument ×1
filenames ×1
rmdir ×1
warnings ×1
xml ×1
ziparchive ×1