本文整理汇总了PHP中person::set_password方法的典型用法代码示例。如果您正苦于以下问题:PHP person::set_password方法的具体用法?PHP person::set_password怎么用?PHP person::set_password使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类person
的用法示例。
在下文中一共展示了person::set_password方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_password
public $username;
public $password;
const MINCHAR = 10;
public function set_password($digit)
{
// ekhane digit hocche parameter
// return $this -> password = " 123456";
// $this -> password = " 123456";
if (strlen($digit) < self::MINCHAR) {
//Jokhon constant use korbo tokhon this use na kore self:: use korte hobe.
//echo " Password requires minimum ". self::MINCHAR . " Characters" ;
throw new Exception(" Password requires minimum " . self::MINCHAR . " Characters");
} else {
//echo " Successful ";
//$this -> password = $digit;
//$this -> password = md5($digit); // jodi amra cai password # hoye jak tahole md5 format likhbo.same line ke nicer moto koreo lekha jay.
$this->password = hash('md5', $digit);
//uporer line and ei line same. md5 er place sha256 likhle arekta format hobe.
//echo $digit . " Password is set successfully ";
echo " Password is set successfully ";
}
}
}
$durjoy = new person();
//echo $durjoy -> set_password(); // function er vitore return kore ekane echo korle kaj kore.
//$durjoy -> set_password(); // $durjoy object er vitor theke set_password() ke ber kore niye aslam.
// echo $durjoy -> password; //etao same kaj kore. uporer line and ei line eksathe.
$durjoy->set_password("1234567890a");
// jehetu class er vitore function er paramter($digit) deya ache so ekhaen obossoi argument thakte hobe.
var_dump($durjoy);
// instentiate korar por se class er vitore ki ki ache ta dekhar jonno var_dump() use korte hoy.