我有以下文件夹结构:
-storage
-app
-orders
-cat1
-cat2在cat1或cat2文件夹中(取决于用户输入),我希望创建另一个文件夹并在其中放置一个xml文件。
这就是我试图在cat1-folder中创建目录并将xml文件放在其中的方式:
$uuid = Uuid::uuid4();
$id = $uuid->toString();
$path = '/orders/cat1/'.$id;
Storage::makeDirectory($path, 0755, true, true);
Storage::put($id.'test.xml', $xml);发生了什么:
在正确的位置创建文件夹($id作为名称):
-storage
-app
-orders
-cat1
-123456789
-cat2但是xml将存储在下面的另一个文件夹中:
-storage
-app
-123456789 // xml gets stored in another
-test.xml // folder within app-folder
-orders
-cat1
-123456789 // where the xml should be placed
-cat2我只是想找到一种方法将xml放到我刚刚创建的._目录中。
发布于 2019-07-31 10:44:21
Storage::put从app文件夹开始。
使用以下代码:
Storage::put($path . '/test.xml', $xml);发布于 2019-07-31 10:44:14
你可以试着把它存储成这样:
Storage::put($path . '/test.xml', $xml);https://stackoverflow.com/questions/57288901
复制相似问题