php - Yii - call member function out of Yii? -
i know it's not legal, , looking odd. it's necessary me. have 2 project, 1 custom open-cart , second in yii. main project in opencart. yii project kept in main project root.
now want call yii function in opencart. please me , tell how call yii function in main project ?
this yii function :-
$sm=yii::app()->getsecuritymanager(); if ($salt === null) $salt = yii::app()->params['password_security_salt']; if($salt==null) $salt=md5 (mt_rand ().mt_rand ().mt_rand ().mt_rand ()); $pass=sha1($salt.$pass.$salt); return $sm->hashdata($pass,$key).':'.$salt;
.....................
i want create new function manually opencart project. please me create new project same functionality yii (upper function) function.
you can use yii functionality outside of yii project initialising application so:
// in someotherfile.php outside of yii project require_once('framework/yii.php'); $config = require_once('protected/config/main.php'); yii::createwebapplication($config); // call function yii::app()->getsecuritymanager();
obviously paths yii.php
file , application config (main.php
) need change fit project structure
Comments
Post a Comment