怎样根据$hello数据将$str层层展开?
php codedir_ws_template.'includes/', dir_ws_classes =>dir_ws_admin.'helloworld', dir_ws_template =>template/, dir_ws_admin =>admin/ );//怎样得到这样的结果数组: $my_arr=array( dir_fs_aaa . dir_ws_classes, dir_ws_template.'includes/'.dir_ws_template.'includes/', template/includes/admin/includes/ );?>
------解决方案--------------------
php code$my_arr[] = $str;$tmp = preg_replace(/[a-z_]+/e, \$hello['\\0'], $str);$my_arr[] = $tmp;$tmp = preg_replace(/[\']?\s*\.?\s*([a-z_]+)\s*\.?\s*[\']/e, \$hello['\\1'], $tmp);$my_arr[] = $tmp;//testprint_r($my_arr);/**array( [0] => dir_fs_aaa . dir_ws_classes [1] => dir_ws_template.'includes/' . dir_ws_admin.'helloworld' [2] => template/includes/admin/helloworld')/**/