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不会,求代码,兄弟,感谢了。。 PHP连接MYSQL问题 这个不知道哪里错了7,8行报错 PHP 請教下關於小數正則的問題 关于一个计数器的小程序问题 用move_uploaded_file上传文件时,能设定文件属性吗? php 函数速度问题,在线给分! 求PHP考试系统 在线等!!关于页面提交到E-mail的问题,高手多多指教!! 谁会使用安全链接?(关于SSL的问题) 请各位大大帮忙,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不会,求代码,兄弟,感谢了。。