1
file_put_contents('c_' . $id . '_node.json', $jsonData);
現在、ルートディレクトリに新しいファイルを作成しますが、このファイルの内容を特定のフォルダに配置したいと考えています。ファイルをフォルダに入れるにはどうすればいいですか?
file_put_contents('c_' . $id . '_node.json', $jsonData);
現在、ルートディレクトリに新しいファイルを作成しますが、このファイルの内容を特定のフォルダに配置したいと考えています。ファイルをフォルダに入れるにはどうすればいいですか?
ちょうど最初のパラメータに
file_put_contents('PATH/TO/FOLDER_NAME/c_' . $id . '_node.json', $jsonData);
これを取得しないと、プロジェクトのルートフォルダに生成されます。これは次のようになります。 file_put_contents( 'json_data/c_'。$ id。 '_node.json'、$ jsonData); –
'ますfile_put_contents( '特定のフォルダ/ C_' $のID '_node.json'、$ jsonData。。)それを追加し、フォルダが存在すると仮定;' – Andreas
を試してみました? 'file_put_contents('/my/path/to/the/folder/c_ '$ id。' _node.json '、$ jsonData); '? –
は最初のパラメータでフルパスを与えます。 – Bhavin