Codeans.com – คำตอบของการเขียนเว็บไซต์

สอนเขียนเว็บไซต์ ด้วย HTML, PHP, Javascript, CSS, AJAX, MySQL

Posts Tagged 'PHP'

PHP สคริปต์สำหรับหาค่า ตัวแปร ใน Querystring ของ URL.

ปกติแล้วสำหรับการหาค่า ตัวแปร Qeurystring ของ URL (ในเพจปัจจุบัน) สามารถทำได้โดย การเรียกใช้ตัวแปร $_GET ซึ่งจะเก็บตัวแปรต่างๆ ของ Querystring ในรูปแบบของ array แต่ถ้าต้องการหาค่า Querystring ของ URL อื่น ๆ จะทำอย่างไร มาดูกันครับ โจทย์ ให้หาค่าตัวแปร Querystring ของ URL => http://www.codeans.com/store.php?location=surat&shop=0&sales_id=86 [code] <?php $url =http://www.codeans.com/store.php?location=surat&shop=0&sales_id=86; $lastUrl =parse_url($_SERVER['HTTP_REFERER']); parse_str($lastUrl['query'], $lastGet); // show result print "<pre>"; print_r($lastGet); ?> [/code] จะเห็นว่าโปรแกรมจะคืนค่า querystring ให้ตัวแปร $lastGet ในรูปแบบของอาร์เรย์

21 September 2009 at 14:28 - Comments

mod rewrite สำหรับ รับค่า $_GET จาก URL .html

[ENGLISH DEV] many people ask some question, How to make rewrite rule in .htaccess with mod_rewrite in apache. the rule use to get query string from .html url, i try to make this with few time and i found how to solve this problem, follow this. – Firstly make .htaccess file. – For get querystring more »

9 January 2009 at 15:23 - Comments