当前位置:Gxlcms > PHP教程 > PHP二维数组输出解决办法

PHP二维数组输出解决办法

时间:2021-07-01 10:21:17 帮助过:7人阅读

PHP二维数组输出
把定义好数组后按URL传值的结果输出数组。如接收传值name=baidu,则按html格式输出baidu数组。请问如何实现?

$b-title = baidu;
$b-keyword = search;
$b-content = baidu search;
$g-title = google;
$g-keyword = search;
$g-content = google search;
$baidu=array('baidu'=>array('$b-title','$b-keyword','$b-content'));
$google=array('google'=>array('$g-title','$g-keyword','$g-content'));
?>

输出:











------解决方案--------------------
变量:数字、字母、下划线
字符串:引号括起来。
------解决方案--------------------
$b_title = 'baidu';
$b_keyword = 'search';
$b_content = 'baidu search';
$baidu = array('b-title'=>$b_title,'b-keyword'=>$b_keyword,'b-content'=>$b_content);
echo http_build_query($baidu);

人气教程排行