我有一个 xml 文件,我尝试将一些信息显示到 php 表单中。
所以我一直在尝试做这样的事情:
<?php
$url="tmp/".$_GET['n_doss']."-".date('d-m-Y')."-legale.xml";
if(file_exists($url))
{
$chaineXML= $url;
$dom = new DomDocument();
$dom->load($chaineXML);
$date = $dom->getElementsByTagName('time');
$time = DateTime::createFromFormat("d/m/Y H:i:s", $date->item(0)->nodeValue);
$datecreditsafe=date_format($time, 'd-m-Y');
if($dom->getElementsByTagName('errors')->length != 0)
{
header('Location: index.php?p=add_debiteur&n_doss='.$_GET['n_doss'].'&type='.$_GET['type'].'&mode='.$_GET['mode'].'&step=4&creditsafe=false&siret='.$_GET['siret'] );
}
else
{
if(!empty($data['forme_juridique']))
{
echo "<label>Forme juridique:</label><input type='text' name='forme_juridique'><br>";
}
else
{
if($dom->getElementsByTagName('legalform')->length != 0)
{
$etat = $dom->getElementsByTagName('legalform');
$forme_juridique=$etat->item(0)->nodeValue;
echo "<label>Forme juridique:</label><input type='text' name='forme_juridique' value='".utf8_decode(stripslashes($forme_juridique))."'><br>";
}
else
{
echo'<label for="forme_juridique">Forme Juridique:</label><table width="45%" border="0">
<tr>
<td width="50%"><input type="checkbox" name="forme_juridique" value="SAS" onclick="limite_check(this.name, 1)" />
SAS</td>
<td width="50%"><input type="checkbox" name="forme_juridique" value="SA" onclick="limite_check(this.name, 1)" />
SA</td>
</tr>
<tr>
<td><input type="checkbox" name="forme_juridique" value="SARL" onclick="limite_check(this.name, 1)" />
SARL</td>
<td><input type="checkbox" name="forme_juridique" value="EURL" onclick="limite_check(this.name, 1)" />
EURL</td>
</tr>
<tr>
<td><input type="checkbox" name="forme_juridique" value="SNC" onclick="limite_check(this.name, 1)" />
SNC</td>
<td><input type="checkbox" name="forme_juridique" value="SDF" onclick="limite_check(this.name, 1)" />
SDF</td>
</tr>
<tr>
<td><input type="checkbox" name="forme_juridique" value="Société Particulière" onclick="limite_check(this.name, 1)" />
Société Particulière </td>
<td><input type="checkbox" name="forme_juridique" value="Entreprise Individuelle" onclick="limite_check(this.name, 1)" />
Entreprise Individuelle</td>
</tr>
<tr>
<td><input type="checkbox" name="forme_juridique" value="Artisan" onclick="limite_check(this.name, 1)" />
Artisan</td>
<td><input type="checkbox" name="forme_juridique" value="Commerçant" onclick="limite_check(this.name, 1)" />
Commeçant</td>
</tr>
<tr>
<td><input type="checkbox" id="box" name="forme_juridique" value="Autre" onclick="GereControle(\'box\', \'forme_juridique2\', \'1\');limite_check(this.name, 1)"/>
Autre</td>
<td><input type="text" name="forme_juridique2" id="forme_juridique2" style="visibility:hidden" /></td>
</tr>
</table>';
}
}
}
但真正的麻烦是它只向我显示这个变量的一部分:实际上要显示的真实部分是:SA à conseil d'administration
它只向我显示 SA à conseil d
我尝试了几件事,例如:
str_replace("'","'",$str)
或者
htmlentities($str, ENT_QUOTES, "UTF-8")
或再次mysql_real_escape_string
或addslashes
和stripslashes
但我没有找到让它工作的方法。
预先感谢您的帮助