PHP cannot write to text file

前端 未结 1 1602
逝去的感伤
逝去的感伤 2021-01-29 15:16

I have the following code which I am using in WordPress/Woocommerce:

function generatePassword($length = 6) {
$characters = \'0123456789abcdefghijklmnopqrstuvwxy         


        
相关标签:
1条回答
  • 2021-01-29 15:45

    You have to provide Web server path of actual file location path in your server instead of url.

    $test = 'http://advokatami.bg/ot/a/docs/test/test.txt';
    

    Replace it by Server path

    $test = '<location_of_your_webroot_folder_in_server>/ot/a/docs/test/test.txt';
    

    Make sure test have permission for read and write publicly.

    How can you check your folder path?

    1) Make test.php file in ot folder with below code

    <?php
    echo dirname(__FILE__);
    die();
    

    2) Upload it in ot folder.

    3) execute file from browser http://advokatami.bg/ot/test.php

    4) Copy path before \ot\.... and replace it on <location_of_your_webroot_folder_in_server>.

    0 讨论(0)
提交回复
热议问题