我创建一个简单的PHP应用程序,我想用YAML文件作为数据存储。我将得到的数据作为一个关联数组,通过这种结构,例如:
$user = array('username' => 'martin', 'md5password' => '5d41402abc4b2a76b9719d911017c592')
不过,我想延长一些功能的关联数组,并使用->
运营商,这样我就可以写的东西是这样的:
$user->username = 'martin'; // sets $user['username']
$user->setPassword('hello'); // writes md5 of 'hello' to $user['md5password']
$user->save(); // saves the data back to the file
有没有办法做到这一点没有一个类定义的好方法?
基本上,我想在PHP中的JavaScript样式对象:)
应该这些天至少使用sha1。 – wesside
+ wesside 2016更新:BCrypt通过password_hash或PBKDF2与SHA512。 – mjsa
@mjsa方式看看! – wesside