{"id":3154,"date":"2019-06-13T00:05:40","date_gmt":"2019-06-13T00:05:40","guid":{"rendered":"http:\/\/softlect.in\/?p=3154"},"modified":"2019-06-13T00:37:48","modified_gmt":"2019-06-13T00:37:48","slug":"php-file-handling","status":"publish","type":"post","link":"http:\/\/softlect.com\/index.php\/php-file-handling\/","title":{"rendered":"PHP File Handling"},"content":{"rendered":"<p>Files:<\/p>\n<p>In PHP it is possible to create, read, and write files on the server system. The first step is to open a file and associate it with a variable name. The variable is known as file variable. The fopen() function is used to perform the above operation of opening the form. This function takes two parameters: filename and use indicator. The use indicator is a string which specifies the operations that can be performed on the file. The possible values of use indicator are:<\/p>\n<p>\u201cr\u201d , \u201cr+\u201d , \u201cw\u201d , \u201cw+\u201d , \u201ca\u201d and \u201ca+\u201d<\/p>\n<p>&nbsp;<\/p>\n<p>For example:<\/p>\n<p>$filevar = fopen(\u201cfilename\u201d , \u201cuse indicator\u201d);<\/p>\n<p>&nbsp;<\/p>\n<p>$filevar\u00a0 = fopen(\u201ctest.data\u201d, \u201cr\u201d);<\/p>\n<p>&nbsp;<\/p>\n<p>Reading from file:<\/p>\n<p>$filedata = fread($filevar, filesize(\u201ctest.data\u201d);<\/p>\n<p>&nbsp;<\/p>\n<p>writing to file:<\/p>\n<p>$byteswritten = fwrite($filevar, $content);<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Files: In PHP it is possible to create, read, and write files on the server system. The first step is to open a file and associate it with a variable&hellip; <\/p>\n","protected":false},"author":1,"featured_media":3181,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[82],"tags":[],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/posts\/3154"}],"collection":[{"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/comments?post=3154"}],"version-history":[{"count":2,"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/posts\/3154\/revisions"}],"predecessor-version":[{"id":3166,"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/posts\/3154\/revisions\/3166"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/media\/3181"}],"wp:attachment":[{"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/media?parent=3154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/categories?post=3154"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/tags?post=3154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}