Page 303 - CITS - CSA - TP (Volume 1) - Hindi
P. 303
कंप्यूटर सॉफ्टवेयर एप्लीकेशन- CITS
टा 5: रीड करने के िलए फ़ाइल ओपन करना
1 टे एिडटर ओपन कर
2 िन िल खत कोड िलख
<html>
<body>
<?php
// File path
$filePath = ‘my_new_file.txt ;
// Open the file in read mode
$fileHandle = fopen($filePath, ‘r );
// Check if file opened successfully
if ($fileHandle) {
// File opened successfully, perform operations here
echo “File opened successfully.”;
// Close the file handle
fclose($fileHandle);
} else {
// File opening failed, handle error
echo “Failed to open file.”;
}
?>
</body>
</html>
3 ो ाम को C:\Apache24\htdocs म .php ए ट शन वाले फ़ो र म सेव कर
4 Apache सिव स को िवंडोज़ से रन कर
5 ाउज़र ओपन कर और िन एड ेस टाइप कर
http://localhost/foldername/
6 रन करने के िलए php फ़ाइल पर क कर और आउटपुट वेरीफाई कर
287
CITS : IT & ITES - कं ूटर सॉ वेयर ए ीके शन - अ ास 55

