php 虽然我在localhost上使用xml获取的数据可以正常工作,但当我将其发送到托管服务器时,页面不能完全工作

uurity8g  于 2022-12-28  发布在  PHP
关注(0)|答案(1)|浏览(69)

虽然我在localhost上用XML取的数据在工作,但当我把它扔到托管上时,页面并不能完全工作,不仅XML代码,其他php和html代码也被禁用了,以前有人遇到过这样的问题吗?如果有,你能帮忙吗?
php程式码

$link="https://www.tcmb.gov.tr/kurlar/today.xml";
    
    $icerik=simplexml_load_file($link);
    
    
    /*echo "<pre>";
    
    print_r($icerik);
    
    echo "</pre>";*/
    
    
    $usd_kodu=$icerik->Currency[0]["CurrencyCode"];
    $Usd_adi=$icerik->Currency[0]->Isim;
    $Usd_birim=$icerik->Currency[0]->Unit;
    $Usd_alis=$icerik->Currency[0]->ForexBuying;    
    $Usd_satis=$icerik->Currency[0]->ForexSelling;  
    $Usd_efektifAlis=$icerik->Currency[0]->BanknoteBuying;      
    $Usd_efektifSatis=$icerik->Currency[0]->BanknoteSelling;
    $usd_id=1; // veri tabanı idleri xml ile çekilmedi

超文本标记语言代码
'

<tr>
            <th width="133" height="36" align="center" style="font-style: normal; font-weight: bold; font-size: large;" scope="col">Döviz Kuru</th>
            <th width="113" align="center" style="font-style: normal" scope="col">Adı</th>
             <th width="113" align="center" style="font-style: normal" scope="col">Kodu</th>
            <th width="113" align="center" style="font-style: normal" scope="col">Birimi</th>
            <th width="118" align="center" style="font-style: normal" scope="col">Alış Fiyatı</th>
            <th width="130" align="center" style="font-style: normal" scope="col">Satış Fiyatı</th>
            <th width="99" align="center" style="font-style: normal" scope="col">Efektif Alış</th>
            <th width="119" align="center" style="font-style: normal" scope="col">Efektif Fiyatı</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <th rowspan="3" align="center" valign="middle" style="font-size: medium" scope="row">TCMB</th>
            <td height="51" align="center"><?php echo $Usd_adi;   ?></td>
             <td height="51" align="center"><?php echo $usd_kodu;   ?></td>
            <td align="center"><?php echo $Usd_birim; ?></td>
            <td align="center"><?php echo $Usd_alis;   ?></td>
            <td align="center"><?php echo $Usd_satis;    ?></td>
            <td align="center"><?php echo $Usd_efektifAlis;    ?></td>
            <td align="center"><?php echo $Usd_efektifSatis;    ?></td>
          </tr>

'
我希望这些代码在托管和本地主机上都能正常工作,但是没有

k97glaaz

k97glaaz1#

您的主机是否支持SimpleXML?您可以通过以下方式进行检查

phpinfo();

还要确保你有一个有效的ssl认证

相关问题