This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* __toString()方法 是在直接输出对象引用时自动调用的。 | |
* 魔术方法: http://www.php.net/manual/zh/language.oop5.magic.php | |
*/ | |
class TestClass{ | |
public $foo; | |
public function __construct($foo) { | |
$this->foo = $foo; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 获取客户端 IP | |
* @author Sure Yu http://yusure.cn | |
* @date 2018-03-21 | |
* @param [param] | |
* @return [type] [description] | |
*/ | |
function getIP() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* 参考资料:https://www.cnblogs.com/eleven24/p/7487923.html */ | |
$closure = function ($name, $age) { | |
$this->name = $name; | |
$this->age = $age; | |
}; | |
class Person { | |
public $name; | |
public $age; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[SolarizedDarkModify] | |
text=839496 | |
cyan(bold)=00ffff | |
text(bold)=e9e9e9 | |
magenta=c000c0 | |
green=80ff00 | |
green(bold)=3c5a38 | |
background=042028 | |
cyan=00c0c0 | |
red(bold)=ff0000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 调试信息写文件 | |
* 在 shell 窗口用 tail -f yusure_dubug.txt 配合查看日志 | |
*/ | |
function sure_dump( $data ) | |
{ | |
file_put_contents( 'yusure_dubug.txt' , var_export( $data, true ) . PHP_EOL, FILE_APPEND ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //version my202 | |
//set allowTestMenu to false to disable System/Server test page | |
$allowTestMenu = true; | |
$use_mysqli = function_exists("mysqli_connect"); | |
header("Content-Type: text/plain; charset=x-user-defined"); | |
error_reporting(0); | |
set_time_limit(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* CDN、反向代理 获取真实 ip 的配置方法 */ | |
log_format main '$http_x_forwarded_for - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
access_log /dev/stdout main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"caret_style": "phase", | |
"color_scheme": "Packages/User/SublimeLinter/Laravel (SL).tmTheme", | |
"dpi_scale": 1.0, | |
"font_face": "Consolas", | |
"font_options": | |
[ | |
], | |
"font_size": 14, | |
"highlight_modified_tabs": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 首页静态化脚本 | |
* Author: Yusure | |
* Blog: yusure.cn | |
*/ | |
ini_set( 'date.timezone', 'PRC' ); | |
/* 缓存过期时间 单位:秒 */ | |
$expire = 86400; |