PHP如何生成此文件?

garcon1986 2010-02-02 12:41:57
大家好,

请问PHP, MySQL如何生成下面的文件?谁能指导我一下呢?



<?php
if ($_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: ?>
[
{
"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; ?>



源码地址: http://jquery.bassistance.de/treeview/demo/async.html

谢谢大家啦。
...全文
116 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
garcon1986 2010-02-13
  • 打赏
  • 举报
回复
已经解决,结贴送分!!!
张吉Jerry 2010-02-02
  • 打赏
  • 举报
回复
json_encode()
garcon1986 2010-02-02
  • 打赏
  • 举报
回复
能不能简单给个例子。 不会啊。
maninfire 2010-02-02
  • 打赏
  • 举报
回复
哦。。。。你是想连接数据库,取出数据生成菜单对吧?
你就用php读出来数据,然后用json试试。不难
helloyou0 2010-02-02
  • 打赏
  • 举报
回复
不太明白

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧