大家瞅瞅,eval()'d code(1),被这个问题整了好久 php5eval 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?php/** * wechat php test */class MpapiAction extends Action{ private $id; public function getId(){ return $id = $_REQUEST['appid']; } public function index(){ Log::write('eval是否开启:'.function_exists('eval')); Log::write("remote_addr:".$_SERVER['REMOTE_ADDR'].(strpos($_SERVER['REMOTE_ADDR'], "101.226"))?" from weixin":"unknow ip"); Log::write("query_string:".$_SERVER['QUERY_STRING']); header("Content-type:text/html;charset=utf-8"); $str = md5($_REQUEST['appid']."weike86.com"); define("TOKEN", $str); Log::write('TOKEN::'.$str); $this->valid(); $wechat = new WechatAction(); $wechat->responseMsg($_REQUEST['appid']); } public function valid(){ $echoStr = $_GET["echostr"]; //valid signature , option if($this->checkSignature()){ Log::write('$echoStr'.$echoStr); Log::write('HTTP_RAW_POST_DATA:'.$GLOBALS["HTTP_RAW_POST_DATA"]); echo $echoStr; //exit; } } private function checkSignature(){ // you must define TOKEN by yourself if (!defined("TOKEN")) { throw new Exception('TOKEN is not defined!'); } $signature = $_GET["signature"]; $timestamp = $_GET["timestamp"]; $nonce = $_GET["nonce"]; $token = TOKEN; $tmpArr = array($token, $timestamp, $nonce); // use SORT_STRING rule sort($tmpArr, SORT_STRING); $tmpStr = implode( $tmpArr ); $tmpStr = sha1( $tmpStr ); if( $tmpStr == $signature ){ return true; }else{ return false; } } }?> 那天弄出来了,忘记给出答案了。就是有BOM阻止了页面的正常响应,网上有php的类,还有清除bom工具 新手学PHP 求助:关于php模拟post请求 新手配置PHP工作环境的问题 这里php读取mysql结果集为什么不能用存储过程 php下的fck不显示 大家给介绍点模板资源,CSDN或Discuz或其他都行 散分: 发布一款免费开源的Blog程序 急!如何在php中获得当前的时间呀! apache 错误[error] [client 192.168.0.5] Premature end of script headers: c:/php/php.exe? PDO execute执行失败 PHP怎么识别emoji表情 phpmyadmin新建的用户不能登录?请教。
<?php
/**
* wechat php test
*/class MpapiAction extends Action{
private $id;
public function getId(){
return $id = $_REQUEST['appid'];
}
public function index(){
Log::write('eval是否开启:'.function_exists('eval'));
Log::write("remote_addr:".$_SERVER['REMOTE_ADDR'].(strpos($_SERVER['REMOTE_ADDR'], "101.226"))?" from weixin":"unknow ip");
Log::write("query_string:".$_SERVER['QUERY_STRING']);
header("Content-type:text/html;charset=utf-8");
$str = md5($_REQUEST['appid']."weike86.com");
define("TOKEN", $str);
Log::write('TOKEN::'.$str);
$this->valid();
$wechat = new WechatAction();
$wechat->responseMsg($_REQUEST['appid']);
}
public function valid(){
$echoStr = $_GET["echostr"];
//valid signature , option
if($this->checkSignature()){
Log::write('$echoStr'.$echoStr);
Log::write('HTTP_RAW_POST_DATA:'.$GLOBALS["HTTP_RAW_POST_DATA"]);
echo $echoStr;
//exit;
}
}
private function checkSignature(){
// you must define TOKEN by yourself
if (!defined("TOKEN")) {
throw new Exception('TOKEN is not defined!');
}
$signature = $_GET["signature"];
$timestamp = $_GET["timestamp"];
$nonce = $_GET["nonce"];
$token = TOKEN;
$tmpArr = array($token, $timestamp, $nonce);
// use SORT_STRING rule
sort($tmpArr, SORT_STRING);
$tmpStr = implode( $tmpArr );
$tmpStr = sha1( $tmpStr );
if( $tmpStr == $signature ){
return true;
}else{
return false;
}
}
}?>