Home  >  Article  >  Backend Development  >  Detailed explanation of setting method of PHP general return value

Detailed explanation of setting method of PHP general return value

墨辰丷
墨辰丷Original
2018-05-24 11:30:581614browse

本篇文章主要介绍PHP通用返回值的设置方法详解,感兴趣的朋友参考下,希望对大家有所帮助。

遇到一个不错的php代码。记录一下。

在写php代码时,经常会遇到需要返回值的情况,可以统一设置一下返回值的格式。

下面就是一个不错的例子。

配置类Return.conf.php

 0, 'msg' => '', 'data' => '');");

define("RETURN_SUCCESS",    0); 
define("RETURN_RUNTIME_ERR",  1); 
define("RETURN_FILE_NOT_EXIST", 2); 

class ReturnConf{
  public static function CommonReturn(){
    return eval(return_val);
  }  
}
?>

测试、使用test.php

以上就是本文的全部内容,希望对大家的学习有所帮助。


相关推荐:

DVWA之php+mysql手工注入

php5.5.12 下调试 SOAP 报错信息 

PHP中 HTMLPurifier防XSS攻击

The above is the detailed content of Detailed explanation of setting method of PHP general return value. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn