- 浏览: 94519 次
- 性别:
- 来自: 北京
-
最新评论
-
lunzi:
sqllite3 installhttp://www.supe ...
linux架设subversion(svn) -
lunzi:
libiconv.so.2: cannot open shar ...
linux架设subversion(svn)
文章列表
yii的项目开发过程中,经常使用到验证码,yii框架提供了CCaptchaAction类,来提供验证码图片功能,经常会碰到验证码图片不显示的问题。
主要有两个问题导致:
1、bom问题(把文件涉及到bom的php代码去掉bom即可)
2、 输出图像之前,没有加ob_clean()清空输出缓冲区:
//加此代码块解决
if(function_exists('ob_clean')){
@ob_clean();
}
imagecolordeallocate($image,$foreCo ...
升级php 7.0之后,由于php7.0不再支持mysql扩展,只好升级为pdo mysql方式。
装好php7.0新环境之后,遇到CDbConnection 无法开启数据库连线: SQLSTATE[HY000] [2002]错误
解决方式:
在centos里边,通过
find / -name mysql.sock 找到 /var/lib/mysql/mysql.sock
然后找到 php.ini
修改
pdo_mysql.default_socket= /var/lib/mysql/mysql.sock
...
nginx 301 跳转配置
- 博客分类:
- nginx
server {
listen 80;
server_name xxx.com;
index index.php index.html index.shtml index.htm;
root /eetop/nginx/out_hibeauty;
return 301 http://test.com;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ .*\.( ...
环境:
master:192.168.2.142
slave :192.168.2.143
两者都装了mysql 5.6.10
硬件环境都一样,vmware下centos 6.2
内存 1GB
磁盘 20GB
CPU 2个
在master端创建测试数据库
[root@localhost ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.10 Source distribution
Copyright ( ...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EETOP.AbleAPI.Common
{
/// <summary>
/// 常用正则表达式
/// </summary>
public class CommonRegex
{
public const string email = "^\\w+((-\\w+)|(\\.\\w+))*\\ ...
location ~ .*\.(php|php5)
{
try_files $uri =404;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
...
php批量去掉bom的方法
<?php
$auto = 1;
checkdir('F:/php/wwwroot/teamga');
function checkdir($basedir){
if ($dh = opendir($basedir)) {
while (($file = readdir($dh)) !== false) {
if($file{0} == '.')
{
continue;
}
if ($file != '.' && $file != '..'){
if (!is_dir($ ...
linux下dns配置
- 博客分类:
- linux
# vi /etc/resolv.conf
nameserver 8.8.8.8 #google域名服务器
nameserver 8.8.4.4 #google域名服务器
php通过curl下载远程图片实例
- 博客分类:
- php
<?php
$url = 'http://mf1905.com/upload/video_img/df3074c98ec5124ad47c52ff59f74e04_middle.jpeg';
function http_get_data($url) {
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_CUSTOMREQUEST, 'GET' );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt ( $ch, CURLOPT ...
初始化mysql的表数据的存储过程
begin
declare i int default 4000001;
REPEAT
INSERT INTO `eetopin_weibo2` VALUES (i, '', '3363', '1', '3363', '1', '0', '0', '0', '0', '0', '0', '0', '1', '1387963683', '1387963683');
set i=i+1;
UNTIL i>=5000001
end REPEAT;
end
第一步:
准备thanks.c thanks2.c文件
thanks.c源码
#include <stdio.h>
int main(void)
{
printf("Hello World\n");
thanks2();
}
thanks2.c源码
#include <stdio.h>
void thanks2(void){
printf("Thank you!\n");
}
第二步:
编写makefile
main: thanks.o thanks2.o
gcc -o th ...
php下的jsonp使用实例
- 博客分类:
- php
参考资料:http://www.cnblogs.com/chopper/archive/2012/03/24/2403945.html
测试依赖条件:
项目eetopinOfficial 在hosts绑定 www.eetopin.com域名
项目sns 在hosts绑定sns.com域名
测试代码文件及源码:
eetopinOfficial/testCookie.php
<?php
header('Content-type: application/json');
//获取回调函数名
$callback = $_GET ['callback'];
$value = $_GET ...
第一步:BaseTestCase.php
<?php
define("REAL_PATH", "E:/wwwroot/eetopin/");
require_once ('PHPUnit/Framework/TestCase.php');
require (REAL_PATH.'eetopinWebConfig/config.php');
define ( 'EETOPIN_WEB_LIB', REAL_PATH.'eetopinWebLib/' );
define ( 'EETOPIN_PUBLIC', REAL_PATH.'ee ...
前端文件
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>消息提醒</title>
</head>
<body>
<div id="hd">
<ul class="panel">
收件箱<span data-type="msg">0</sp ...
今天有同事问一个j2ee事务的问题,做个小的总结:
1、基于注解的事务
在类和方法上配置类似
@Transactional(propagation=Propagation.SUPPORTS,readOnly=true)代码的
2、基于配置文件的事务
在xml文件配置类似
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
< ...