PHP highlight_file() ফাংশন
সংজ্ঞা ও ব্যবহার
highlight_file() ফাংশন ফাইলকে প্রকাশিত করে
গঠন
highlight_file(filename,return)
পারামিটার | বর্ণনা |
---|---|
filename | বাধ্যতামূলক।প্রকাশিত করতে হলে PHP ফাইলের পাথ |
return | বাধ্যতামূলক নয়।যদি সত্য সমাধান করা হয়, তবে এই ফাংশন প্রকাশিত কোড ফিরিয়ে দেবে |
ব্যাখ্যা
এই ফাংশন PHP প্রকাশিত কোড প্রোগ্রামের রঙ ব্যবহার করে, প্রকাশিত কোডকে ধারণকৃত এবং প্রদর্শিত করে filename এর কোডের প্রকাশিত সংস্করণ
অনেক সার্ভার সম্প্রসারণকৃত ফাইলকে প্রকাশিত করার জন্য কনফিগার করা হয়েছে phps সম্প্রসারণের ফাইলকে স্বয়ংক্রিয়ভাবে প্রকাশিত করা।উদাহরণ হিসেবে, example.phps দেখার সময়, তা প্রকাশিত সোর্স কোডকে দেখাবে।এই সুবিধা সক্রিয় করতে, নিচের এই সূত্রটি যোগ করুন httpd.conf:
AddType application/x-httpd-php-source .phps
return value
if return If the parameter is set to true, the function will return the highlighted code instead of outputting it. Otherwise, if successful, it returns true, and if failed, it returns false.
Tips and Comments
Warning:It should be noted that when using the highlight_file() function, do not inadvertently leak sensitive information such as passwords or other types of sensitive information, otherwise potential security risks may occur.
Example
"test.php":
<html> <body> <?php highlight_file("test.php"); ?> </body> </html>
Output:
<html> <body> <?php highlight_file("test.php"); ?> </body> </html>
The result in the browser is similar to this:
<html> <body> <code> <span style="color: #000000"><html> <br /> <body> <br /> <span style="color: #0000BB"><?php <br />highlight_file</span> <span style="color: #007700">(</span> <span style="color: #DD0000">"test.php"</span> <span style="color: #007700">);<br /></span> <span style="color: #0000BB">?><br /></span> </body> <br /> </html></span> </code> </body> </html>