3
我已經創建了一個php腳本來從xml讀取數據並將其寫入到oracle數據庫 xml數據具有html標記。其中有各種語言,如英語,俄語,意大利語,德語。將xml數據寫入oracle數據庫
在PHP中我讀從XML數據
$xml=simplexml_load_file($file);
foreach($xml as $value)
{
$text='';
if($value->englishtext=='')
{
$text=htmlentities(str_replace("'", "'", $value->translatedtext), ENT_HTML5);
}
else
{
$text=htmlentities(str_replace("'", "'", $value->englishtext), ENT_HTML5);
}
}
插入查詢 INSERT INTO國際VALUES(seq_id.nextval,$文本)
$stid2 = oci_parse(
$conn,
"INSERT INTO UILABELINT VALUES (seq_uilabelint_id.nextval,'".$localeid."','".$filename."','".$value['ID']."',$text)"
);
我真正的問題是一些次數據插入正確,有時候html標籤沒有正確編碼。
任何機構可以建議我
- 天氣我要用htmlentities()或沒有。
- 我應該怎麼做才能在html5中顯示這些html標籤。
XML數據
<?xml version="1.0" encoding="UTF-8"?>
<Resources>
<Section ID="AddListing">
<englishtext><![CDATA[Add Listing]]></englishtext>
<translatedtext/>
</Section>
<Section ID="DirectPayment">
<englishtext><![CDATA[Receive <b>direct payments</b> from travelers.]]</englishtext>
<translatedtext/>
</Section>
</Resources>
請舉正好插入使用 – jondinham 2014-08-28 04:22:12
$ stid2 = oci_parse($康恩你就像查詢,「INSERT INTO UILABELINT VALUES(seq_uilabelint_id .nextval ' 「$的LocaleID。」', ' 「$文件名。」','」 $的值。[ 'ID']。 「」,$文本)」); – 2014-08-28 04:25:21
你能分享一個沒有正確編碼的html標籤的例子嗎? – 2014-08-28 04:25:32