首页 > 解决方案 > File commands not working on XAMPP PHP server

问题描述

I have set up XAMPP on a UNIX OS ie: Ubuntu. Any file command is not working properly ie: file_exists,file_put_contents. I am trying to create a login system whereby I am storing the login data in a folder called "Users". But on using file_put_contents("Users/"+$user, $pass) where $user and $pass is a valid string. It creates a file named 0 outside the User folder with the contents of the $pass. I have tried using absolute path but still am facing the same issue.

Any help is appreciated.

标签: phpxampp

解决方案


运算符+不习惯连接,您必须使用.而不是作为

file_put_contents("Users/".$user, $pass);

或者,

file_put_contents("Users/$user", $pass)

推荐阅读