Home  >  Article  >  Backend Development  >  php foreach 循环数组 并设定key,该如何处理

php foreach 循环数组 并设定key,该如何处理

WBOY
WBOYOriginal
2016-06-13 11:26:57997browse

php foreach 循环数组 并设定key

<br /><br />foreach($role as $k=>$v){<br />	$arrayRole[$k=$v->role_id]=$v->role_code;					<br /><br />} <br /><br />



如题   我写的  key  总是设置不了 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn