求助php解析内容~~

worldhj1 2015-02-17 12:04:21
$url = " http://dev.test/test.php?msg=".$keyword;
我请求一个api返回的是这么一个格式的内容
[msg]我先说[/msg]

$output = file_get_contents($url);
求助后续如何解析这个内容并且能获取我先说~~~ 万分感谢~~~~

对了请求参数keyword还需要GBK编码~~~~
...全文
116 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
傲雪星枫 2015-02-17
  • 打赏
  • 举报
回复

echo '<meta http-equiv="content-type" content="text/html;charset=utf-8">';
$content = '[msg]我先说[/msg]';
preg_match('/\[msg\](.*)\[\/msg\]/is', $content, $matches);

echo $matches[1];

21,886

社区成员

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

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