PHP 輸出到檔案

  1. 將 $data 以函式 print_r 輸出到檔案 /tmp/file.txt。
    $output = print_r($data, true);
    file_put_contents('/tmp/file.txt', $output);