I am using the php array to put in ng-init of AngularJS.
PHP array:
Array
(
[0] => Array
(
[username] => admin
[email] => admin@gmail.com
)
)
AngularJS ng-init:
How to convert the output to:
"username='admin';email='admin@gmail.com'"
not tested but should work
function convert_array($arr){
$tmp_arr=array();
foreach($arr as $key=>$value){
$tmp_arr[]=$key."='".$value."'";
}
return join(';',$tmp_arr)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.