create file in another directory with php

后端 未结 5 1202
一生所求
一生所求 2021-02-01 21:51

My folder structure is like -

root
  admin
    create_page.php
  pages
    my_page1.php
    my_page2.php

I have code for creating a new php fi

5条回答
  •  盖世英雄少女心
    2021-02-01 22:31

    $ourFileHandle = fopen("../pages/" .$ourFileName, 'w') or die("can't open file");
    

    Make the above change to the third line and it will probably work; I tried it and it worked.

提交回复
热议问题