I am trying to create a PHP file in a directory,but its not creating. Here is my code:
function createPage(){
$name='test';
$file=base_url()."test/".$name.".php";
$handle = fopen($file, 'w') or die('Cannot open file: '.$file);
}
This shows me:
failed to open stream HTTP wrapper does not support writable connections error.
Can anyone fix this problem? I am new in PHP file handling.
base_url()which likely includes an absolute path, such as,http://localhost/path/to/my/files/, which will throw the error. Simply supply a relative path.testfolderbase_url()with file.