请问一段PHP代码是什么意思?

WBOY
Release: 2016-06-23 13:44:06
Original
961 people have browsed it

在网上看到一段PHP代码,由于我没学过PHP,不知道是什么意思,求各位大虾帮忙解释。。。。。。

<?phpif ($_REQUEST['root'] == "source"):?>[	{		"text": "1. Pre Lunch (120 min)",		"expanded": true,		"classes": "important",		"children":		[			{				"text": "1.1 The State of the Powerdome (30 min)"			},		 	{				"text": "1.2 The Future of jQuery (30 min)"			},		 	{				"text": "1.2 jQuery UI - A step to richnessy (60 min)"			}		]	},	{		"text": "2. Lunch  (60 min)"	},	{		"text": "3. After Lunch  (120+ min)",		"children":		[			{				"text": "3.1 jQuery Calendar Success Story (20 min)"			},		 	{				"text": "3.2 jQuery and Ruby Web Frameworks (20 min)"			},		 	{				"text": "3.3 Hey, I Can Do That! (20 min)"			},		 	{				"text": "3.4 Taconite and Form (20 min)"			},		 	{				"text": "3.5 Server-side JavaScript with jQuery and AOLserver (20 min)"			},		 	{				"text": "3.6 The Onion: How to add features without adding features (20 min)",				"id": "36",				"hasChildren": true			},		 	{				"text": "3.7 Visualizations with JavaScript and Canvas (20 min)"			},		 	{				"text": "3.8 ActiveDOM (20 min)"			},		 	{				"text": "3.8 Growing jQuery (20 min)"			}		]	}]<?php else: sleep(1); ?>[	{		"text": "1. Review of existing structures",		"expanded": true,		"children":		[			{				"text": "1.1 jQuery core"			},		 	{				"text": "1.2 metaplugins"			}		]	},	{		"text": "2. Wrapper plugins"	},	{		"text": "3. Summary"	},	{		"text": "4. Questions and answers"	}	]<?php endif; ?>
Copy after login


回复讨论(解决方案)

 中间的才是php代码

其余的是个json格式字符串

似乎在拼凑json的数据

我好想知道蹭的那些是什么代码 是  javascript 吗?

这基本不是php
整个文件绝大部分是json

。。。。
?>
这个符号里面的才是php,你这是php嵌入到json中,php起判断作用

如果传root参数
生成一个json数据
否则小睡会生成另一个json数据

这个json数据会有别的js去处理的

脱离上下文,这是一段毫无意义的代码

这难道不是一份表格?
好吧,我是初学者= =

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template