php - 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.
解决方案
运算符+
不习惯连接,您必须使用.
而不是作为
file_put_contents("Users/".$user, $pass);
或者,
file_put_contents("Users/$user", $pass)
推荐阅读
- java - 如何在其他类中实现接口和扩展
- vue.js - 我们可以将数据从 django 模板发送到 vuejs 吗?
- java - Jslider 反映在面板中
- python - 如何使用 matplotlib 在折线图上叠加散点图?
- ios - CollectionView 内的 iOS TableView 有时会显示不正确的数据
- python - Python - 如何从单个列表创建元组列表
- ios - 如何以编程方式更改 UIDatePicker 的选定日期颜色 - Swift 4?
- twig - 在 for 循环中调用宏
- scala - 为 Slick 使用单独的 ExecutionContext
- php - 如何在 PHP 中统计每个月的项目并附上日期?