Good afternoon everyone, I'm trying to access a windows shared folder on the same network through php (laravel) using the scandir method. here is some sample code
$dir = '\\\\192.168.1.18\\Data';
$files = scandir($dir);
return $files;
I've tried different ways to type the server address (\\192.168.1.18\\Data and so forth).
I get a scandir(\\\\192.168.1.18\\Data): failed to open dir: No such file or directory
thanks in advance
you can check if it's a problem with the shared folder or with the PHP by replacing scandir with this simple linux command:
exec("ls \\\\192.168.1.18\\Data",$result);
print_r($result);
if you will get an error No such file or directory so you have problem with the shared folder.
I think this question might help you. It suggests mounting the Windows share in Linux.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.