สอบถาม php ข้อมูลไม่แสดง

กฎการใช้บอร์ด
คำถามหมวดนี้ ควรระบุ รายละเอียดของ Server OS, เวอร์ชั่น ของ PHP, CMS ที่ท่านใช้
รวมถึง Hosting หรือ Control Panel Hosting

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: สอบถาม php ข้อมูลไม่แสดง

Re: สอบถาม php ข้อมูลไม่แสดง

โดย AePongsak » 01/08/2018 6:38 pm

โค้ด: เลือกทั้งหมด

$xml_value = file_get_contents('http://freegeoip.net/xml/' . $ip);

 $result_xml = simplexml_load_string($xml_value);

 $city = $result_xml->City[0];

<tr class="warning">
    td align="right" width="50%">
          <?php echo "<b>เมือง </b>"; ?></td>
    </td>
     <td>
<?php echo $city; ?>
      </td>                             
</tr>
ตัวอย่างที่ไม่แสดง
รูปภาพ

Re: สอบถาม php ข้อมูลไม่แสดง

โดย thatsawan » 01/08/2018 5:29 pm

ขอดู code
เขียนโปรแกรมโดยใช้ php มีการเรียกข้อมูลจาก xml และใช้งาน js ก่อนหน้านี้ข้อมูลยังแสดงปกติ
อาจจะเกิดจาก
http https

สอบถาม php ข้อมูลไม่แสดง

โดย AePongsak » 01/08/2018 4:40 pm

เขียนโปรแกรมโดยใช้ php มีการเรียกข้อมูลจาก xml และใช้งาน js ก่อนหน้านี้ข้อมูลยังแสดงปกติ
ล่าสุดทดสอบ clone โปรเจคลงมาทำใหม่ ปรากฏว่าข้อมูลไม่แสดง
ลองทดสอบ F12 และเช็คที่ Console ดูพบ error หลายจุด

ไม่ทราบว่าเป็นเพราะอะไร และมีวิธีแก้ไขอย่างไรครับ


รูปภาพ

โค้ด: เลือกทั้งหมด

Loading failed for the <script> with source “http://localhost:8081/joomla/tools/js/bootstrap-select.js”.
index.php:36
SyntaxError: expected expression, got ','[Learn More]
index.php:553:69
uncaught exception: InvalidValueError: myMap is not a function
CSI/tbsd_
cb=gapi.loaded_0:259:127
CSI/_tbnd
cb=gapi.loaded_0:259:127
Content Security Policy: Ignoring “'unsafe-inline'” within script-src: ‘strict-dynamic’ specified
Content Security Policy: Ignoring “https:” within script-src: ‘strict-dynamic’ specified
Content Security Policy: Ignoring “http:” within script-src: ‘strict-dynamic’ specified
Content Security Policy: Ignoring “'unsafe-inline'” within script-src: ‘strict-dynamic’ specified
Content Security Policy: Ignoring “https:” within script-src: ‘strict-dynamic’ specified
Content Security Policy: Ignoring “http:” within script-src: ‘strict-dynamic’ specified
Blocked loading mixed active content “http://localhost:8081/joomla/tools/css/fonts/thsarabunnew_italic-webfont.woff”[Learn More]
index.php
Blocked loading mixed active content “http://localhost:8081/joomla/tools/css/fonts/thsarabunnew_bold-webfont.woff”[Learn More]
index.php
Blocked loading mixed active content “http://localhost:8081/joomla/tools/css/fonts/thsarabunnew-webfont.woff”[Learn More]
index.php
Content Security Policy: The page’s settings observed the loading of a resource at self (“script-src”). A CSP report is being sent. Source: onclick attribute on A element.
sharebutton
perf_trace {"name": "e2e", "parent": "PageEvents.BIGPIPE_ONLOAD"}
04i6TYF0z89.js:94:2791
perf_trace {"name": "e2e", "parent": "PageEvents.BIGPIPE_ONLOAD"}
04i6TYF0z89.js:94:2791

ข้างบน