gpt4 book ai didi

php - 不允许匹配 "[xX][mM][lL]"的处理指令目标

转载 作者:IT王子 更新时间:2023-10-29 00:56:56 25 4
gpt4 key购买 nike

我在 CakePHP 中输​​出 XML。但是当我将 XML 放入验证器时出现此错误:

The processing instruction target matching "[xX][mM][lL]" is not allowed.

我正在使用正确的 XML 布局与 <?php echo $this->Xml->header(); ?>在顶部然后 <?php echo $content_for_layout; ?>

我的结果是:

<?xml version="1.0" encoding="UTF-8" ?><response type='' outcome='true' message='Login successful!'>
<user id='1234' total_number_of_completed_tasks='0' total_number_of_declined_tasks='0' total_number_of_passed_tasks='1' total_number_of_failed_tasks='1' reputation_points='99' deviant_points='0' />
<tasks>
<accepted>
<accepted_task id='4' type='Good' time_limit='500' details='Good accepted' />
<accepted_task id='5' type='OK' time_limit='660' details='Ok New task' />
<accepted_task id='9' type='Excellent' time_limit='2000' details='Great failed task' />
<accepted_task id='11' type='Your type' time_limit='222' details='Running and swimming all the way to Japan' />
<accepted_task id='7' type='Man' time_limit='744' details='My dirty task' />
</accepted>
<pending>
<pending_task id='8' type='Women' time_limit='5151' details='Women new task' sender_id='11111' sent_date='2031-01-01 00:00:00' sender_name='Jae Choi' />
</pending>
<completed>
</completed>
<new>
<new_task id='5' type='OK' time_limit='660' details='Ok New task' />
<new_task id='8' type='Women' time_limit='5151' details='Women new task' />
<new_task id='4' type='Good' time_limit='500' details='Good accepted' />
<new_task id='10' type='Hello' time_limit='122' details='What is this?' />
<new_task id='3' type='Best' time_limit='880' details='Stop doing work!' />
<new_task id='11' type='Your type' time_limit='222' details='Running and swimming all the way to Japan' />
<new_task id='6' type='Great' time_limit='553' details='Great accepted task' />
<new_task id='7' type='Man' time_limit='744' details='My dirty task' />
<new_task id='9' type='Excellent' time_limit='2000' details='Great failed task' />
</new>
</tasks>
</response>

这有什么问题吗?

最佳答案

marmalad 和 El Boletaire Underave 说得对,不能从空格开始,但这还不是全部。根据the XML spec , 在 XML prolog 之前你不能有任何东西。

由于您使用的是 XML 声明,因此您的文件必须以

开头
<?xml version="1.0" ...

在某些情况下,非打印字符,如 the byte order mark (BOM)占用文件的前几个字节可能会造成麻烦。

对于 CakePHP 更具体的问题,请检查文件的开头或结尾(即 ?> 之后或 <?php 之前)是否有杂散的空白行/空格。

关于php - 不允许匹配 "[xX][mM][lL]"的处理指令目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7939426/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com