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
#!/bin/bash | |
wget http://cn2.php.net/get/php-5.6.34.tar.gz/from/this/mirror | |
mv mirror php-5.6.34.tar.gz | |
tar xzvf php-5.6.34.tar.gz | |
cd php-5.6.34 | |
./configure' '--prefix=/data/software/php' '--with-pear' '--enable-bcmath' '--with-bz2' '--with-curl' '--enable-filter' '--enable-fpm' '--with-gd' '--enable-gd-native-ttf' '--with-freetype-dir' '--with-jpeg-dir' '--with-png-dir' '--enable-intl' '--enable-mbstring' '--with-mcrypt' '--enable-mysqlnd' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-pdo-sqlite' '--disable-phpdbg' '--enable-opcache' '--with-openssl' '--enable-simplexml' '--with-sqlite3' '--enable-xmlreader' '--enable-xmlwriter' '--enable-zip' '--with-zlib' | |
make | |
make install |
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 | |
function env_load($dir='.') | |
{ | |
$file = "$dir/.env"; | |
if (!is_file($file)) { | |
echo "no .env file $file\n"; | |
exit(1); | |
} | |
if (!is_readable($file)) { |
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 | |
function quote_parse ($sql) | |
{ | |
$n = mb_strlen($sql); | |
$state = 0; | |
$word = ''; | |
$ret = []; | |
$quote = ''; | |
for ($i=0; $i < $n; $i++) { | |
$ch = mb_substr($sql, $i, 1); |
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 | |
namespace Lib; | |
use Exception; | |
use Psr\Container\ContainerInterface; | |
use Psr\Container\ContainerExceptionInterface; | |
use Psr\Container\NotFoundExceptionInterface; | |
class Container implements ContainerInterface | |
{ |
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 | |
function get_first_line($content) { | |
$pos = -1; | |
do { | |
$pos = strpos($content, "\n", $pos+1); | |
$found = trim(substr($content, 0, $pos)); | |
// http://blog.sina.com.cn/s/blog_49f914ab0101eyjj.html | |
} while (trim(substr($content, 0, $pos), "\r\n\t \xEF\xBB\xBF") === ""); | |
return substr($content, 0, $pos); | |
} |
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 | |
/* vim: set expandtab tabstop=4 shiftwidth=4: */ | |
// +----------------------------------------------------------------------+ | |
// | PHP version 4.0 | | |
// +----------------------------------------------------------------------+ | |
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | | |
// +----------------------------------------------------------------------+ | |
// | This source file is subject to version 2.0 of the PHP license, | | |
// | that is bundled with this package in the file LICENSE, and is | | |
// | available at through the world-wide-web at | |
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
alias tl="tmux ls" | |
alias ta="tmux attach" |
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 | |
$f = isset($_GET['f']) ? $_GET['f'] : ''; | |
if (!$f) { | |
die("plz specify f"); | |
} | |
if (!is_file($f)) | |
die("$f is not a file"); | |
header("Content-Type:text/plain;charset=UTF-8"); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
</head> | |
<body> | |
<canvas id="canvas" width="220" height="220"></canvas> | |
<script type="text/javascript"> | |
var canvas = document.getElementById('canvas'); |
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 | |
$zip = new ZipArchive; | |
$res = $zip->open($file); | |
if ($res === TRUE) { | |
for ($i=0;($filename=$zip->getNameIndex ($i))!==false; $i++) { | |
echo "$filename\n"; | |
if ($filename[strlen($filename)-1] == '/') { | |
$filename = iconv('UTF-8', 'GBK', $filename); | |
if (!is_dir($filename)) { |