Execute the php file and collect the output

4 May 2016

Share to:

ในบทความนี้ผมจะอธิบายวิธีการ Execte ไฟล์ php แล้วเอา output ไปใช้งานต่อ ตัวอย่างเช่น ถ้าเรามีไฟล์ cal.php สําหรับ ทําอะไรซักอย่าง แล้วเราต้องการจะเรียกใช้ไฟล์ดังกล่าวเพื่อเอาผลลัพธ์ไปใช้งาน เราจะสามารถเขียน code ได้ดังนี้

<?PHP
    ob_start();
    include "cal.php";
    $out = ob_get_clean();
?>

ผลลัพธิ์การ Execute ไฟล์ cal.php จะถูกเก็บในตัวแปร $out สามารถนําไปใช้ต่อได้เลย

Suggestion blogs

ติดตั้ง windows 10 บน raspberry pi2

สวัสดีครับ ในบทความนี้ผมจะสอนวิธีการติดตั้ง windows 10 บน raspberry pi2 โดยผมจะแบ่งออกเป็นสองส่วนดังนี้ติดตั้ง Windows 10 IoT Core toolsติดตั้ง Windows 10 IoT Core ลงใน SD Card

Configure the Linux Firewall for Docker Swarm on Ubuntu

บทความนี้จะเกี่ยวข้องกับการ Config Linux Firewall ให้สามารถใช้งาน Docker swarm ได้ ถ้าไม่ได้ Config เราจะเจอกับ Error นี้ "Timeout was reached before node was joined. The attempt to join the swarm will continue in the background. Use the "docker info" command to see the current swarm status of your node." ในขั้นตอนการ Join Swarm เพราะว่า Docker Swarm ใช้งาน port ดังต่อไปนี้

[ภาษาซี] การกําหนดค่าเริ่มต้นให้กับตัวแปร

ในภาษาซี นอกจากประกาศตัวแปรขึ้นใช้งานแล้ว เรายังสามารถกําหนดค่าเริ่มต้นให้กับตัวแปรไปพร้อมกันได้ด้วย คือ


Copyright © 2019 - 2024 thiti.dev |  v1.39.0 |  Privacy policy | 

Build with ❤️ and Astro.

Github profile   Linkedin profile   Instagram   X profile   Youtube channel   Telegram   Email contact   วงแหวนเว็บ