Skip to content

Instantly share code, notes, and snippets.

@mly520
mly520 / ImageGd.php
Created June 26, 2013 11:15
CI gd libaray
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ImageGd
{
public function convert_en($im1)
{
$w = imagesx($im1);
$h = imagesy($im1);
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* KAI eCRM
*
* 画像操作クラス
*
* @package application
* @author an
* @version 1.0α
* @filesource
@mly520
mly520 / calendar_lang.php
Created June 26, 2013 11:30
php ci language
<?php
$lang['cal_su'] = "日";
$lang['cal_mo'] = "月";
$lang['cal_tu'] = "火";
$lang['cal_we'] = "水";
$lang['cal_th'] = "木";
$lang['cal_fr'] = "金";
$lang['cal_sa'] = "土";
$lang['cal_sun'] = "日曜";
@mly520
mly520 / config.php
Created July 25, 2013 09:39
fuelphp 1.6 config.php 設定
<?php
/**
* Part of the Fuel framework.
*
* @package Fuel
* @version 1.7
* @author Fuel Development Team
* @license MIT License
* @copyright 2010 - 2013 Fuel Development Team
* @link http://fuelphp.com
@mly520
mly520 / gist:6304345
Created August 22, 2013 07:59
fuelphp aws-sdk install ※s3 サンプル
1:
composer.jsonファイルを編集
"require": {
"php": ">=5.3.3",
"monolog/monolog": "1.5.*",
"fuelphp/upload": "2.0",
"aws/aws-sdk-php": "2.2.*"
},
// 自動生成 sublime text を使うと便利
Generators resource users
username:string[50],email:string[100],password:string[100],active:tinyinteger:defalut(0),suspended:tinyinteger:defalut(0),level:integer:defalut(1),deleted_at:timestamp:nullable()
※model/User.php は予め用意されていますので、消されないように注意してください。
@mly520
mly520 / s3.php
Created August 22, 2013 14:07
fuelphp s3 sampple
use Aws\Common\Aws;
class Controller_S3 extends Controller
{
public function action_index()
{
// Config::load('aws', true);
$aws = Config::get('aws');
$s3 = Aws::factory( $aws['services']['default_settings']['params'] )->get('s3');
@mly520
mly520 / php-session
Created August 25, 2013 10:28
php-session
1 什么是会话控制
出现原因:http是无状态协议的,每次都是不同的服务器请求,无法维护两个请求事务之间的关系.
会话控制:能够在网站中跟踪一个变量,通过对变量的跟踪,就可以使多个请求事物之间建立联系,根据授权和用户身份显示不同的内容,不同页面
cookie:是服务器设置在客户端的文本文件,保存客户端得个人信息.
2 会话跟踪技术
1 隐藏表单域
2 url重写
3 cookie技术
4 session技术
@mly520
mly520 / number_to_zhongwen.php
Created August 25, 2013 11:54
php 数字转换汉字
test2();
/**
* 方法测试
*/
function test2() {
echo IntToCn(333030); // 三十三万三千零三十
echo IntToCn(1111); // 一千一百一十一
echo IntToCn(101010101); // 一亿一百零一万零一百零一
}
@mly520
mly520 / thinkphp php-gree
Last active December 21, 2015 16:28
php 树状结构
//首先做一个类内的变量,存储一下相关的数组:
public $tree = null;
//然后做个测试方法,用于输出结果
public function test() {
$res = M('channel')->where('fatherid is null')->select();
$this->createtree($res);
dump($this->tree);
}