php如何通过地址去获取一个网页的标题title里面的内容。 比如,我在文本框里面输入一个网址。点击“获取标题”按钮,如何才能获取到标题并写入到下面的文本框里面。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 一个后端页面 gettitle.php (代码我复制的,没测试)function get_title($html){ $html=strtolower($html); $title = str_replace(" - ",",",cut($html,"<title>", "</title>" ));//if ($title == "") $title = "无标题";if ($title) $title=replace_word(textcut($title,80));if ($title) $title=preg_replace("/<(.*?)>/","",$title);return addslashes(trim($title));}你的前端页面 点击获取标题后 触发 ajax 到后端页面 取得返回的json 或字符串 赋值给你的相应input value 触发 ajax 到后端页面 取得返回的json 或字符串 赋值给你的相应input valueajax不会,求代码,兄弟,感谢了。。 一个PHPCHINA青岛 学员的愤怒和无奈,请求广大PHPer帮忙!!! 数据添加(急) 写入COOKIE的问题 php.ini 无法调出来ftp扩展 FastCGI Error 关于PHP配置的问题。 一个小问题 PHP菜鸟问题。 请懂php、mysql的网友进来看一下,不是问题 php怎么连接mysql-proxy 请各位大大帮忙,php中session数组合并的问题! 获取按钮id
function get_title($html)
{
$html=strtolower($html);
$title = str_replace(" - ",",",cut($html,"<title>", "</title>" ));
//if ($title == "") $title = "无标题";
if ($title) $title=replace_word(textcut($title,80));
if ($title) $title=preg_replace("/<(.*?)>/","",$title);
return addslashes(trim($title));
}
你的前端页面 点击获取标题后 触发 ajax 到后端页面 取得返回的json 或字符串 赋值给你的相应input value
触发 ajax 到后端页面 取得返回的json 或字符串 赋值给你的相应input valueajax不会,求代码,兄弟,感谢了。。