Home  >  Article  >  Backend Development  >  PHP二维数组输出解决办法

PHP二维数组输出解决办法

WBOY
WBOYOriginal
2016-06-13 11:51:041442browse

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

<br /><?php<br />   $b-title = baidu;<br />   $b-keyword = search;<br />   $b-content = baidu search; <br />   $g-title = google;<br />   $g-keyword = search;<br />   $g-content = google search; <br />$baidu=array('baidu'=>array('$b-title','$b-keyword','$b-content'));<br />$google=array('google'=>array('$g-title','$g-keyword','$g-content'));<br />?><br /><br />输出:<br /><html><br />    <head><br />        <title></title><br />       <meta name="keywords" content="" /><br />    </head><br />    <body><br />    <br />    </body><br /></html><br />


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

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