Skip to content

Instantly share code, notes, and snippets.

View wenjun1055's full-sized avatar

WenJun wenjun1055

  • Baidu Inc.
  • Beijing,China
View GitHub Profile
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>

##PHP 5.4新特性##

掌握

  • traits
    trait的引入,可以扩展class的内容,使class在某种形式上实现了多重继承,更加灵活,trait不能被实例化 示例代码:

    <?php
    

trait Hello {

学会用strace:

strace -o php.log -s 65535 php -i

然后在 php.log 中找ini:

open("/usr/bin/php-cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/php-cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/bin/php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/etc/php.ini", O_RDONLY)

<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
@wenjun1055
wenjun1055 / common.php
Last active January 9, 2019 15:30
封装的一些常用的方法
<?php
/**
* Method dump
* @return void
*/
function dump() {
echo '<pre>';
$argument_list = func_get_args();
foreach ($argument_list as $variable) {
#!/bin/bash
iptables_ip(){
FILE=$1
egrep -iv "Baiduspider|bingbot|360Spider|JianKongBao|Ezooms|msnbot|Safari|AhrefsBot|Firefox|TurnitinBot|bot|AppleWebKit" $FILE|awk '{print $1}' |sort -n|uniq -c|sort -nr|awk '{if ($1>50) print $1" "$2}' >.tmp_ip
if [ -s .tmp_ip ]
then
while read line
do
memcached 1.4.2
-p <num> 监听的TCP端口(默认: 11211)
-U <num> 监听的UDP端口(默认: 11211, 0表示不监听)
-s <file> 用于监听的UNIX套接字路径(禁用网络支持)
-a <mask> UNIX套接字访问掩码,八进制数字(默认:0700)
-l <ip_addr> 监听的IP地址。(默认:INADDR_ANY,所有地址)
-d 作为守护进程来运行。
-r 最大核心文件限制。
-u <username> 设定进程所属用户。(只有root用户可以使用这个参数)
-m <num> 所有slab class可用内存的上限,以MB为单位。(默认:64MB)
@wenjun1055
wenjun1055 / cnzz.py
Created June 6, 2016 16:24 — forked from iamued/cnzz.py
Cnzz api with python
__author__ = 'richie'
# -*- coding: utf-8 -*-
import urllib, urllib2, cookielib, re, os, codecs, time, subprocess,sys,json
#import simplejson as json
import dateutil
class cnzz(object):
def __init__(self, username = '', password = '',othername=''):
self.__username = username
self.__othername = othername
self.__password = password