notify_url.php ➔ log_result()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 7
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * 名称 返回页面
4
 * 功能  支付宝外部服务接口控制
5
 * 版本  0.6
6
 * 日期  2006-6-10
7
 * 作者   http://www.buybay.org
8
  * 联系   Email: [email protected]  Homepage:http://www.buybay.org
9
 * 版权   Copyright2006 Buybay NetTech
10
 */
11
require_once("alipay_notify.php");
12
require_once("alipay_config.php");
13
$alipay = new alipay_notify($partner,$security_code,$sign_type,$_input_charset,$transport);
14
$verify_result = $alipay->notify_verify();
15
if($verify_result) {
16
	
17
	
18
	echo "success";
19
	//这里放入你自定义代码,比如根据不同的trade_status进行不同操作
20
	log_result("verify_success"); //将验证结果存入文件	
21
}
22
else  {
23
	echo "fail";
24
	//这里放入你自定义代码,这里放入你自定义代码,比如根据不同的trade_status进行不同操作
25
	log_result ("verify_failed");
26
}
27 View Code Duplication
function  log_result($word) {
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
28
	$fp = fopen("log.txt","a");	
29
	flock($fp, LOCK_EX) ;
30
	fwrite($fp,$word.":执行日期:".strftime("%Y%m%d%H%I%S",time())."\t\n");
31
	flock($fp, LOCK_UN); 
32
	fclose($fp);
33
}
34
	
35
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...