PHP微信2次开发的问题,如何设置分组关键字 phpcookies微信2次开发 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 正好我做了一个这个功能, 不过我不知道其他人怎么做的。 不知道我这种方法是不是最正确的。 //如果存在之前输入的天气 if(file_exists('weather'.$this->getRequest('tousername').'.txt')){ if(@file_get_contents('weather'.$this->getRequest('tousername').'.txt')=='1'){ /**/ require('weather.php'); $weather_replace_arr = array('天气','市','预报','-',' '); $weather_keyword = str_replace($weather_replace_arr, '', $keyword); $keys = array_search($weather_keyword, $weatherArr); if($keys>0){ $wea = file_get_contents('http://www.weather.com.cn/data/sk/'.$keys.'.html'); $wea = json_decode($wea); $wea = $wea->weatherinfo; $strword = $wea->city. '当前温度:'.$wea->temp.','. $wea->WD . $wea->WS.'发布时间:'.$wea->time; }else{ $strword = $weather_keyword . '的天气查询不到'."\n你可以直接输入天气南昌的形式查询天气或者用刚刚的交互模式"; } /**/ //$strword= $keyword.'good'; file_put_contents('weather'.$this->getRequest('tousername').'.txt', '0'); } } //判断是否是查询天气预报 $weather_keyword= ' '.$keyword; if(strpos($weather_keyword, '天气')==1){ require('weather.php'); $weather_replace_arr = array('天气','市','预报','-',' '); $weather_keyword = str_replace($weather_replace_arr, '', $weather_keyword); //如果只输入天气二字,则提示再输入城市 if($weather_keyword==''){ $strword = '请输入需要查询的城市名'; // store session data @file_put_contents('weather'.$this->getRequest('tousername').'.txt', '1'); }else{ $keys = array_search($weather_keyword, $weatherArr); if($keys>0){ $wea = file_get_contents('http://www.weather.com.cn/data/sk/'.$keys.'.html'); $wea = json_decode($wea); $wea = $wea->weatherinfo; $strword = $wea->city. '当前温度:'.$wea->temp.','. $wea->WD . $wea->WS.'发布时间:'.$wea->time; }else{ $strword = $weather_keyword . '的天气查询不到Ya'; } } } 针对每个ID创建文件这个开销是不是太大了,关键这个文件不知道什么时候删,又不是跟session文件一样系统会自己处理 可以把寫文件的步驟寫入memcache,然後設置超時時間。 沒有memcache 就自己生成一個緩存文件 每天晚上0點 清空. mysql提交空值为0问题 别人给我手机终端接口的协议,用PHP如何输出到文件里? php怎么提取小括号里内容 紧急请教!提交订单读入数据库为什么这么慢 请教各们高手,apache配置的问题。 再次问刷新问题??? 高手能否帮我解决php上传图片到数据库中或者谁有这样的代码,请给我,高分奉送!解决后给300分 PHP如何开发? php中<script language="javascript"></script>语句没用 PHP curl获取百度静态图乱码,请教高手们 mysql 查询问题 php 访问路径的问题
//如果存在之前输入的天气
if(file_exists('weather'.$this->getRequest('tousername').'.txt')){
if(@file_get_contents('weather'.$this->getRequest('tousername').'.txt')=='1'){
/**/
require('weather.php');
$weather_replace_arr = array('天气','市','预报','-',' ');
$weather_keyword = str_replace($weather_replace_arr, '', $keyword);
$keys = array_search($weather_keyword, $weatherArr);
if($keys>0){
$wea = file_get_contents('http://www.weather.com.cn/data/sk/'.$keys.'.html');
$wea = json_decode($wea);
$wea = $wea->weatherinfo;
$strword = $wea->city. '当前温度:'.$wea->temp.','. $wea->WD . $wea->WS.'发布时间:'.$wea->time;
}else{
$strword = $weather_keyword . '的天气查询不到'."\n你可以直接输入天气南昌的形式查询天气或者用刚刚的交互模式";
}
/**/
//$strword= $keyword.'good';
file_put_contents('weather'.$this->getRequest('tousername').'.txt', '0');
}
}
//判断是否是查询天气预报
$weather_keyword= ' '.$keyword;
if(strpos($weather_keyword, '天气')==1){
require('weather.php');
$weather_replace_arr = array('天气','市','预报','-',' ');
$weather_keyword = str_replace($weather_replace_arr, '', $weather_keyword);
//如果只输入天气二字,则提示再输入城市
if($weather_keyword==''){
$strword = '请输入需要查询的城市名';
// store session data
@file_put_contents('weather'.$this->getRequest('tousername').'.txt', '1');
}else{
$keys = array_search($weather_keyword, $weatherArr);
if($keys>0){
$wea = file_get_contents('http://www.weather.com.cn/data/sk/'.$keys.'.html');
$wea = json_decode($wea);
$wea = $wea->weatherinfo;
$strword = $wea->city. '当前温度:'.$wea->temp.','. $wea->WD . $wea->WS.'发布时间:'.$wea->time;
}else{
$strword = $weather_keyword . '的天气查询不到Ya';
}
}
}