Execute the php file and collect the output

4 May 2016,
Share: 

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

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

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

Suggestion blogs

Vue.js เริ่มต้น ตอน7 (Class and Style Bindings)

ในตอนที่ 7 นี้จะเกี่ยวกับเรื่อง Class and Style Bindings ใน vue.js ครับ ในการจัดการ Class และ Style เราสามารถใช้ v-bind ได้ เพื่อให้เราสามารถใส่ Logic หรือ ตัวแปรลงไปได้ ทําให้เราสามารถทํา Class  และ Style แบบ Dinamic ได้ง่ายขึ้น

swap memory ใน ubuntu

swap คือ file ประเภทหนึ่งที่ทําหน้าที่คลาย ram โดยจะต่างจาก ram ตรงที่ เป็นไฟล์ที่ถูกเขียนบน HDD ซึ่งจะมีความเร็วน้อยกว่า ram ในกรณีที่ ram ไม่พอ เราสามารถสร้าง swap มาใช้เป็น ram สํารองได้

ติดตั้ง และ share printer to raspberry pi or linux computer

สวัสดีครับ ในบทความนี้ผมจะมาแนะนําวิธีการ ติดตั้ง printer ใน raspberry pi หรือ computer ที่มี os เป็น linux ในการจัดการ printer บน linux จะต้องใช้โปรแกรม CUPS เข้ามาช่วย


Copyright © 2019 - 2025 thiti.dev |  v1.53.0 |  Privacy policy | 

Build with ❤️ and Astro.

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