หัวข้อ: การ Forward หน้าเวบไปยังที่อื่น เริ่มหัวข้อโดย: PinkkeyHost ที่ 07 ก.ค. 2006 21:00 สำหรับการ Forward หน้าเวบไปยังที่อื่นนั้นทำได้หลายวิธี ขอแนะนำ 2 วิธีง่ายๆที่นิยมกันดังนี้ครับ
1.Redirect เป็นการ Redirect ไปยังอีก url หนึ่ง ซึ่งในช่อง url ก็จะแสดงเป็น url ที่ใหม่ เช่นพิมพ์ http://www.start.com ก็จะไปยัง http://www.destination.com โดยในช่อง url จะแสดงเป็น http://www.destination.com โดยการสร้างไฟล์ index.php ดังนี้ โค๊ด: <?php ตัวอย่าง http://demo.pinkkeyhost.com/forward.php >> http://demo.pinkkeyhost.com/smeweb/index.phpheader("location:http://www.destination.com/path/file"); ?> 2. URL Frame เป็นการนำหน้าเวบอีกแห่งหนึ่งมาแสดงภายใต้ url ของเรา เช่นพิมพ์ http://www.start.com ก็จะแสดงข้อมูลของหน้า http://www.destination.com โดยในช่อง url จะยังแสดงเป็น http://www.start.com ทำได้โดยการสร้างไฟล์ index.html ดังนี้ โค๊ด: <html><head><title>Your Title</title></head> ตัวอย่าง http://demo.pinkkeyhost.com/frame.html (frame https://demo.pinkkeyhost.com/smeweb/index.php)<frameset cols="*"> <frame name="main" src="http//www.destination.com/path/file" scrolling="auto" noresize> <noframes> <body> <center> Your browser does not support frames<br> Please click <a href="same url as above">here</a> to enter. </center> </body> </noframes> </frameset> </html> ปล. สามารถสร้างไฟล์ชื่ออื่นๆนอกจาก index ก็ได้แต่เวลาเรียกต้องระบุชื่อไฟล์ด้วยครับ |