테스트 사이트 - 개발 중인 베타 버전입니다

구글 피드 php : error on line 2 at column 1: Start tag expected, '<' not found 채택완료

WIDOK 1년 전 조회 3,017

구글 피드 php를 건든 적이 없는데,

상품이 잘 등록되다가 어느날 갑자기 이런 오류가 뜨네요..

https://wepromiser.com/shop/price/google_feed.php">https://wepromiser.com/shop/price/google_feed.php

 

http://sir.kr/data/editor/2402/3556103650_1708836384.3763.png" />

This page contains the following errors:

error on line 2 at column 1: Start tag expected, '<' not found

Below is a rendering of the page up to the first error.

 

검색을 따로 해봤는데도 마땅히 나오는 해결 방법이 없어서 질문 남깁니다.

 

아래는 구글 피드 php 1열부터 일부분 복사해서 가져왔습니다..!

 

<?php
include_once("./_common.php");

$sql = "SELECT a.ca_id,
                a.ca_adult_use AS ca_adult,
                IF( SUBSTR(a.ca_id, 3) != \"\", (SELECT ca_adult_use FROM `{$g5['g5_shop_category_table']}` WHERE ca_id = SUBSTR(a.ca_id, 3)), 0) AS ca_adult_parent1,
                IF( SUBSTR(a.ca_id, 5) != \"\", (SELECT ca_adult_use FROM `{$g5['g5_shop_category_table']}` WHERE ca_id = SUBSTR(a.ca_id, 5)), 0) AS ca_adult_parent2,
                IF( SUBSTR(a.ca_id, 7) != \"\", (SELECT ca_adult_use FROM `{$g5['g5_shop_category_table']}` WHERE ca_id = SUBSTR(a.ca_id, 7)), 0) AS ca_adult_parent3, 
                IF( SUBSTR(a.ca_id, 9) != \"\", (SELECT ca_adult_use FROM `{$g5['g5_shop_category_table']}` WHERE ca_id = SUBSTR(a.ca_id, 9)), 0) AS ca_adult_parent4
                FROM `{$g5['g5_shop_category_table']}` AS a";
$result = sql_query($sql);

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

채택된 답변
+20 포인트
1년 전

Warning: SimpleXMLElement::addChild(): unterminated entity reference

에러가 발생하고 있습니다.

 

XML 구문에서 special characters(&, <, >, ", ') 는 escaping 되어야 합니다.

 

다음은 에러발생 예시코드 이며

</p>

<p><?php

$sxe = new SimpleXMLElement('<rss></rss>');

$sxe->addChild('child', 'A & B');

echo $sxe->asXML();

?></p>

<p>

 

그것을 수정한 예시코드 입니다.

</p>

<p><?php

$sxe = new SimpleXMLElement('<rss></rss>');

// $sxe->addChild('child', 'A & B'); // Warning: SimpleXMLElement::addChild(): unterminated entity reference

$sxe->addChild('child', htmlspecialchars('A & B'));

echo $sxe->asXML();

?></p>

<p>

 

건드린 적이 없고 문제없이 동작했는데 갑자기 문제가 생기는 부분은

예외상황에 대처되지 않은 코드로 구성된 상태에서

예외상황을 만난적이 없어서 문제없이 동작했을 가능성이 있습니다.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

W
WIDOK
1년 전
정말 감사합니다. 덕분에 해결했습니다.ㅠㅠ

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인