<?php
$handle = fopen ("http://weather.cn.yahoo.com/weather.html?city=%E5%8C%97%E4%BA%AC", "rb");
$contents = "";
while (!feof($handle)) {
$contents = fread($handle, 1024);
$contents = trim($contents);
if($contents="<!--{{start:今日 -->") {
$start=true;
echo "ok";
}
if($start==true){
$today.=$contents;
}
if($contents=="<!--{{start:明日 -->"){
$start=false;
}
}
fclose($handle);
?>
$handle = fopen ("http://weather.cn.yahoo.com/weather.html?city=%E5%8C%97%E4%BA%AC", "rb");
$contents = "";
while (!feof($handle)) {
$contents = fread($handle, 1024);
$contents = trim($contents);
if($contents="<!--{{start:今日 -->") {
$start=true;
echo "ok";
}
if($start==true){
$today.=$contents;
}
if($contents=="<!--{{start:明日 -->"){
$start=false;
}
}
fclose($handle);
?>
解决方案 »
- DB.php 怎么装 怎么用
- ob_start的问题
- 转让 两本web开发领域最好的图书,《RESTful Web Services中文版》、《XML完全开发指南》,原价133,现在包快递费一起65元
- PHP网站提速三大“软”招
- php 怎样读取unicode编码的txt文档(文档大小在700M)在线等!!!
- post表单提交的内容中 的双引号自动加上了反斜杠了 如何才可以让他们不加上反斜杠?
- 关于 name="num[]" 的提问,请高手解下
- 微博的@功能的实现
- 请问如何取得当前页面的完整地址啊
- Apache如何设置以解释 没有扩展名 的PHP程序
- 求助:需求分析报告的写法?
- 文件上传时怎样限制文件大小以及改变文件名称?
$handle = fopen ("http://weather.cn.yahoo.com/weather.html?city=%E5%8C%97%E4%BA%AC", "rb");
$contents = "";
while (!feof($handle)) {
$contents = fread($handle, 1024);
$contents = trim($contents);
if($contents=" <!--{{start:今日 --> ") { (这里应该是$contents==" <!--{{start:今日 --> ")
$start=true;
echo "ok";
}
if($start==true){
$today.=$contents;
}
if($contents==" <!--{{start:明日 --> "){
$start=false;
}
}
fclose($handle);
?>