Failed to read auto-increment value from storage engine 解决办法
这个问题貌似是个bug,目前也还没什么好的办法解决 有人提交:http://bugs.mysql.com/bug.php?id=52193 解决办法: 1,先把auto_increment的字段的auto_increment属性去掉 2,把那个字段再重新加上auto_increment属性 如果用phpmyadmin等客户端很容易
thinkphp 数据写入
add方法 addAll方法:批量插入数据 // 批量添加数据 $dataList[] = array('name'=>'thinkphp','email'=>'thinkphp@gamil.com'); $dataList[] = array('name'=>'onethink','email'=>'onethink@gamil.com'); $User->addAll($dataList);
placeholdit 占位图生成
http://placehold.it/320x160 如上面的链接,可以生成一个指定尺寸的占位图
thinkphp __construct _initialize 方法
__construct 是php构造函数,如果子类没有则执行父类构造函数,如果子类有,则覆盖父类构造函数 _initialize 是thinkphp中的函数,在__construct 中被调用,如果当前类有,则在实例化后 初始化时执行,其是否执行与父类没有关系 但是在thinkphp中,如果父类使用__construct进行一些初始化,可能在没有实例化完成时无法调用一些函数,比如assign,使用_initialize可以有效解决这个问题
thinkphp U方法显示域名
U(‘地址表达式’,[‘参数’],[‘伪静态后缀’],[‘显示域名’]) 后缀在普通模式时没有效果 只要在显示域名中加入你要显示的域名即可 例如: U(‘Home/index/post’,’’,’’,’10.100.50.101’)
正则表达式 重复次数
重复一次或者多次用 + 表示 重复零次或者多次用 * 表示 重复n次或者多次用 {n} 表示 重复n次以上用 {n,} 表示 重复n次到m次用 {n,m} 表示
less & 符号的使用 less 伪类样式
串联选择器,而不是写后代选择器,就可以用到 & 了 这点对伪类尤其有用如 :hover 和 :focus。 less 函数手册 http://www.1024i.com/demo/less/reference.html less语言特性 http://www.1024i.com/demo/less/document.html
thinkphp 关联模型
模型定义: [pcsh lang=”php” tab_size=”4” message=”” hl_lines=”” provider=”manual”] namespace Home\Model; use Think\Model\RelationModel; class TestModel extends RelationModel{ // 默认表名 protected $tableName = 'a'; // 关联定义 protected $_link = array( // 关联1 'Userrent' => array( 'mapping_type' => self::HAS_ONE, 'class_name' => 'B', 'mapping_n...
thinkcmf使用自定义模版函数
在主题根目录建立function.html 在模版中引入这个文件<tc_include file=”:function”/> 在function.html中编写函数 <php> function _sp_helloworld(){ echo "hello ThinkCMF!"; } </php>
jQuery -animated 选择器
:animated 选择器选取当前的所有动画元素。 就是animate函数操作的元素