我有这个数组:
Array
(
[images] => Array
(
[0] => g
[1] => hp
)
[g] => Array
(
[0] => menu
[1] => submenu
[2] => icons
)
[hp] => Array
(
[0] => cat
[1] => icons
[2] => banners
)
[menu] => Array
(
[0] => v1
)
[submenu] => Array
(
[0] => img
[1] => icons
)
[icons] => Array
(
[0] => v1
)
[cat] => Array
(
[0] => kt
[1] => hk
[2] => bm
[3] => w
[4] => m
[5] => at
[6] => e
)
[banners] => Array
(
[0] => v1
)
[img] => Array
(
[0] => e
)
[kt] => Array
(
[0] => v1
)
[hk] => Array
(
[0] => v1
)
[bm] => Array
(
[0] => v1
)
[w] => Array
(
[0] => v1
)
[m] => Array
(
[0] => v1
)
[at] => Array
(
[0] => v1
)
[e] => Array
(
[0] => v1
)
)
此处images
是主文件夹。我想构造这个数组的所有可能路径,从images
开始作为第一个subArray,如果任何值作为元素存在于数组本身,它也是一个subFolder我想要经历并做同样的事情,直到我构建所有可能的路径。
所以一些可能的路径是:
images/g/menu/v1
images/g/submenu/img/e/v1
请问g
images
中的值是g
中的值,但也存在于数组本身中。所以我通过menu
并且menu
,它再次存在于数组中。同样再次查看v1
的每个值images/g/menu/v1
,这在数组中不存在。所以构造的路径是:subject_list= ['this should work1', '[0000] Unhandled exception in Unknown - class something::something', 'this should work2',
'[0001] URGENT: something is not working', '[0002] subject: something / all users combined into 1', 'this should work3']
description_list = ['1', '2', '3']
for i in subject_list:
try:
fls = open(i + ".txt", 'w')
fls.writelines('')
fls.close()
except Exception as a:
print(a)
pass
。
答案 0 :(得分:0)
可能有更好的方法,但这应该可以解决问题:
//php mysql while
If ($rrows['user_level'] == 1) {?>
//html code
}?>
输出:
while ($rrows = mysql_fetch_array($rs_results)){
if ($rrows['user_level'] == 1){
// display as previously