apache 的这样写
RewriteEngine On
RewriteRule ^(?!index\.php|其他\.php)(.*)\.php$ index.php [L]
nginx的这样写
rewrite ^/(?!index\.php|其他\.php)(.*)\.php$ index.php last;
apache 的这样写
RewriteEngine On
RewriteRule ^(?!index\.php|其他\.php)(.*)\.php$ index.php [L]
nginx的这样写
rewrite ^/(?!index\.php|其他\.php)(.*)\.php$ index.php last;
如果你的php文件用notepad++打开后,右下角是这样的,注意 UTF-8-BOM,那么此文件需要修改为 不含BOM头的UTF-8文件,方法是
点击菜单-》格式-》转为UTF-8 无BOM编码格式,保存即可
有关bom https://www.w3.org/International/questions/qa-utf8-bom
科普: BOM is byte-order mark
另:今天一个客户的thinkphp模版调用utf8 bom 的模版时候,模版里面是frameset,结果导致内容不显示,所以还是要好好处理这个隐蔽的问题啊
首先增加内容模块的url定义
然后把要启用此规则的分类设置为此规则
修改代码 phpcms\modules\content\classes\url.class.php 修改如下内容
增加 .htaccess
注意,以上只是例子代码, catid=6是原始phpcms里面国内新闻对应的id,你正式应用
请修改为你自己的,并且每一个 栏目的伪静态都 大概需要增加这样4行伪静态代码,
注意,不建议做多级嵌套的栏目类分类,比如 /guonei/lanmu1/ , /guonei/lanmu2/
最好只做一级目录就好了
很奇怪的一个错误, 经过简单的核查, 发现出现这种错误的小说占那么一部分. 大致情况是这样 我的小说站数据pc/wap 是共用一个的, pc端一点问题都没有. 而在wap有的小说是没问题的, 有问题的则是打开目录没有问题, 前一部分章节没有问题, 但是后面的章节内容 点之后出现类似PC端404的意思. 给浏览器的显示页面还是当前小说的目录页(没有调出小说内容页), 但是很多数据已经没了, 比如所属类别, 小说名, 最新章节. 仔细检查发现了下面的问题: 1. 出问题的章节, 应该都是类似PC的404页面, 但是却可以调用出部分数据. 2. A小说共100章, 第51章出了问题, 那么在第50章内容页, 点下一章的时候, !!!发现提交的URL是当前小说的目录页.!!!
根据 modules/article/wapreader.php?aid=57549&cid=9345391
查看到 wapreader.php 里面
if(!$package->showChapter($_REQUEST[‘cid’]))
{
echo __LINE__;die();
$package->showIndex();
}
知道应该是 $package->showChapter函数的问题
进而查找 class/wappackage.php 里面
function showChapter($cid)
{
global $jieqiConfigs;
global $jieqi_file_postfix;
$i=0;
$num=count($this->chapters);
while($i<$num){
$tmpvar=$this->getCid($this->chapters[$i][‘href’]);
if($tmpvar==$cid){
$this->makeHtml($i+1, true, true);
return true;
}
$i++;
}
return false;
}
应该是循环后得到了false值,那么为什么呢,说明 $this->chapters 这个值里面没有$_REQUEST[‘cid’]的参数,那么 $this->chapters 从何而来呢,
发现 loadOPF() 函数读取 index.opf ,得到 chapters的数组,里面包含的章节的标题和地址,那么只需要更新这个 index.opf 就能得到最新的数据,那么
$tmpvar=$this->getCid($this->chapters[$i][‘href’]);
就能得到某个章节的值了.
问题解决
http://www.4wei.cn/archives/1001397
fastcgi 模式+非线程安全版本的php 不支持 zend 3.3.3
fastcgi 模式+非线程安全版本的php 不支持 zend 3.3.3
fastcgi 模式+非线程安全版本的php 不支持 zend 3.3.3
重要说三遍
下载如下 smtp_test
phpmailer下载地址 https://github.com/PHPMailer/PHPMailer
类似 clip-share ,AVS 一类的php程序,这linux安装环境,也配置好了诸如ffmpeg , 等等工具,可仍然无法转换视频,查看此类问题的方法是这这类php程序的log里找,比如 tmp/logs/XXX.log 等文件,里面的前面几行一般是运行的命令行,当你手动去运行那个命令行语句的时候,就会调试出问题,有时候碰到的情况是,cli 模式的php使用的php.ini 居然和 web 服务器用的并非一个php.ini ,这时候就需要统一双方的差异了。
http://bbs.zb7.com/thread-3007-1-1.html
发送邮件不成功的话,去检查data/log 下的 xxx__SMTP.php文件内容XXX是本月的日期
163网易邮件系统有个客户端授权码,那个才是smtp的登录密码!!!!
此问题主要是因为 在获取token时候
http://openapi.qzone.qq.com/oauth/qzoneoauth_request_token
造成失败导致。
在 source/plugin/manyou/Service/Client/ConnectOAuth.php的connectGetRequestToken 里面没有正常获取,如图
public function connectGetRequestToken($callback, $clientIp = '') { $extra = array(); $extra['oauth_callback'] = rawurlencode($callback); if ($clientIp) { $extra['oauth_client_ip'] = $clientIp; } $this->setTokenSecret(''); $response = $this->_request($this->_requestTokenURL, $extra); while( trim($response) == 'error_code=20003' ) { $response = $this->_request($this->_requestTokenURL, $extra); } parse_str($response, $params); //var_dump($params);die(); if($params['oauth_token'] && $params['oauth_token_secret']) { return $params; } else { $params['error_code'] = $params['error_code'] ? $params['error_code'] : self::RESPONSE_ERROR; throw new Exception($params['error_code'], __LINE__); } }
最近碰到一些QQ互联登录的问题,可能是php的curl在https 情况下出现 segment falt 造成,终极原因需要修复php curl ssl,
造成的原因可能是libsqlite
参考部分文档地址
http://www.kvm.la/apache-php52-with-php53.html
经检验发现 此文中基本正确除了 .htaccess 需要这样写
<FilesMatch “\.(inc|php|php3|php4|php5|php6|phtml|phps)$”>
AddHandler x-httpd-php52 .inc .php .php3 .php4 .php5 .php6 .phtml
</FilesMatch>
其余需要配置的文件和参考地址相同,现在列出如下
/usr/local/suphp/etc/suphp.conf
[handlers]
;Handler for php-scripts
x-httpd-php5=”php:/usr/local/php5/bin/php-cgi”
x-httpd-php52=”php:/usr/local/webserver/php/bin/php-cgi”
/etc/httpd/conf/extra/httpd-suphp.conf
<IfModule mod_suphp.c>
<FilesMatch “\.(inc|php|php3|php4|php5|php6|phtml|phps)$”>
AddHandler x-httpd-php5 .inc .php .php3 .php4 .php5 .php6 .phtml
</FilesMatch>
<Location />
suPHP_Engine on
suPHP_ConfigPath /usr/local/etc/php5/cgi/
suPHP_AddHandler x-httpd-php5
suPHP_AddHandler x-httpd-php52
</Location>
</IfModule>
#!/bin/bash F="ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz" Aurl="http://dl.wdlinux.cn:5180/soft/" if [[ `uname -m` == "x86_64" ]];then F="ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz" fi if [ ! -f $F ];then wget -c $Aurl/$F fi tar zxvf $F [ $? != 0 ] && echo "file err" && exit if [ ! -d /www/wdlinux/Zend/lib ];then mkdir -p /www/wdlinux/Zend/lib fi if [[ `uname -m` == "x86_64" ]];then cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/*.so /www/wdlinux/Zend/lib/ else cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/*.so /www/wdlinux/Zend/lib/ fi grep '\[Zend\]' /www/wdlinux/apache_php/etc/php.ini if [ $? != 0 -a -f /www/wdlinux/apache_php/etc/php.ini ];then echo '[Zend] zend_extension = /www/wdlinux/Zend/lib/ZendGuardLoader.so zend_loader.enable = 1' >> /www/wdlinux/apache_php/etc/php.ini fi grep '\[Zend\]' /www/wdlinux/nginx_php/etc/php.ini if [ $? != 0 -a -f /www/wdlinux/nginx_php/etc/php.ini ];then echo '[Zend] zend_extension = /www/wdlinux/Zend/lib/ZendGuardLoader.so zend_loader.enable = 1' >> /www/wdlinux/nginx_php/etc/php.ini fi echo echo "ZendGuardLoader is OK"
define('UC_CONNECT', 'mysql');
define('UC_DBHOST', 'localhost');
define('UC_DBUSER', 'root');
define('UC_DBPW', '');
define('UC_DBNAME', 'ultrax');
define('UC_DBCHARSET', 'utf8');
define('UC_DBTABLEPRE', '`ultrax`.pre_ucenter_');
define('UC_DBCONNECT', 0);define('UC_CHARSET', 'utf-8');
define('UC_KEY', 'M1K6F1X3Qaj5d103O8J8Labay219occ7w78d5asbb34aZfGbV2O9t9E5m288NfNd');
define('UC_API', 'http://127.0.0.1/dz/uc_server');
define('UC_APPID', '1');
define('UC_IP', '');
define('UC_PPP', 20);if($_POST)
{include "uc_client/client.php";
$username=$_POST["u"];
$password=$_POST["p"];
$f = uc_get_user($username, 0);
if(!$f)
{uc_user_register($username, $password, $username."@aaa.com");
$f = uc_get_user($username, 0);
}
echo uc_user_synlogin($f[0]) ;
}
uc的客户端uc_clinet/client.php 功能
以uc_get_user 为例子
function uc_get_user($username, $isuid=0) { $return = call_user_func(UC_API_FUNC, 'user', 'get_user', array('username'=>$username, 'isuid'=>$isuid)); return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return); } 此函数调用 client.php 内部 UC_API_FUNC 函数,一般来说UC_API_FUNC 是 定值,你在客户端的后台一般设置是mysql方式的同步 那么 define('UC_API_FUNC', UC_CONNECT == 'mysql' ? 'uc_api_mysql' : 'uc_api_post'); 也就是说 UC_API_FUNC 的值是 uc_api_mysql 下面看 uc_api_myql 函数 function uc_api_mysql($model, $action, $args=array()) { global $uc_controls; if(empty($uc_controls[$model])) { include_once UC_ROOT.'./lib/db.class.php'; include_once UC_ROOT.'./model/base.php'; include_once UC_ROOT."./control/$model.php"; eval("\$uc_controls['$model'] = new {$model}control();"); } if($action{0} != '_') { $args = uc_addslashes($args, 1, TRUE); $action = 'on'.$action; $uc_controls[$model]->input = $args; return $uc_controls[$model]->$action($args); } else { return ''; } } 表示的是 包含了 control/$model.php 运行里面的 on_xxx 比如 onget_user 就是一例 function onget_user() { $this->init_input(); $username = $this->input('username'); if(!$this->input('isuid')) { $status = $_ENV['user']->get_user_by_username($username); } else { $status = $_ENV['user']->get_user_by_uid($username); } if($status) { return array($status['uid'],$status['username'],$status['email']); } else { return 0; } } 这里明显是 $_ENV['user'] 是 model/user.php 的user类引入的 在contrl/user.php 里面看的很清楚 function usercontrol() { parent::__construct(); $this->load('user'); $this->app = $this->cache['apps'][UC_APPID]; } 通过base类的load 函数 function load($model, $base = NULL) { $base = $base ? $base : $this; if(empty($_ENV[$model])) { require_once UC_ROOT."./model/$model.php"; eval('$_ENV[$model] = new '.$model.'model($base);'); } return $_ENV[$model]; } 那么好了,在user->get_user_by_username 和 $user->get_user_by_uid 函数里面选择一个,根据 isuid 来判断参数是否是uid, 从而到uc数据库的UC_DBTABLEPRE."members 根据uid还是username查找.得到的值被重新组织了!!! return array($status['uid'],$status['username'],$status['email']); 如果想得到 uid ,需要从 [0] 里面的!!!
参考此文 http://www.tuicool.com/articles/aqeA7r
手机网页支付产品由手机网页即时到账授权接口(alipay.wap.trade.create.direct)、
手机网页即时到账交易接口(alipay.wap.auth.authandexecute)两个接口组成。
必须先调用手机网页即时到账授权接口(alipay.wap.trade.create.direct)获得授权令牌,
再调用手机网页即时到账交易接口(alipay.wap.auth.authandexecute)完成付款。
wordpress 出现上传媒体文件 最大值是0的情况,多是php.ini 里面禁用了 ini_get 函数,
解决方式是,手动设置个值,在wp-include/media.php 里面
function wp_max_upload_size() { return 1024 * 1024 * 2 ; // phpsir 修改 最大2M $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) ); $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) ); /** * Filter the maximum upload size allowed in php.ini. * * @since 2.5.0 * * @param int $size Max upload size limit in bytes. * @param int $u_bytes Maximum upload filesize in bytes. * @param int $p_bytes Maximum size of POST data in bytes. */ return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes ); }
system/sms/FW_sms.php
里面的 函数 public function sendSMS($mobile_number,$content)
{
….这里是发送短信的代码,修改这里可以改用其他通道,其他通道的sdk,请看各自的文档
}
注意,此方法运行缓慢,切不可在大量访问处使用!或者请使用缓存!
感谢 http://snowcoal.com/article/324.html
function ip_info($ip = NULL, $purpose = "location", $deep_detect = TRUE) { $output = NULL; if (filter_var($ip, FILTER_VALIDATE_IP) === FALSE) { $ip = $_SERVER["REMOTE_ADDR"]; if ($deep_detect) { if (filter_var(@$_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP)) $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; if (filter_var(@$_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP)) $ip = $_SERVER['HTTP_CLIENT_IP']; } } $purpose = str_replace(array("name", "\n", "\t", " ", "-", "_"), NULL, strtolower(trim($purpose))); $support = array("country", "countrycode", "state", "region", "city", "location", "address"); $continents = array( "AF" => "Africa", "AN" => "Antarctica", "AS" => "Asia", "EU" => "Europe", "OC" => "Australia (Oceania)", "NA" => "North America", "SA" => "South America" ); if (filter_var($ip, FILTER_VALIDATE_IP) && in_array($purpose, $support)) { $ipdat = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=" . $ip)); if (@strlen(trim($ipdat->geoplugin_countryCode)) == 2) { switch ($purpose) { case "location": $output = array( "city" => @$ipdat->geoplugin_city, "state" => @$ipdat->geoplugin_regionName, "country" => @$ipdat->geoplugin_countryName, "country_code" => @$ipdat->geoplugin_countryCode, "continent" => @$continents[strtoupper($ipdat->geoplugin_continentCode)], "continent_code" => @$ipdat->geoplugin_continentCode ); break; case "address": $address = array($ipdat->geoplugin_countryName); if (@strlen($ipdat->geoplugin_regionName) >= 1) $address[] = $ipdat->geoplugin_regionName; if (@strlen($ipdat->geoplugin_city) >= 1) $address[] = $ipdat->geoplugin_city; $output = implode(", ", array_reverse($address)); break; case "city": $output = @$ipdat->geoplugin_city; break; case "state": $output = @$ipdat->geoplugin_regionName; break; case "region": $output = @$ipdat->geoplugin_regionName; break; case "country": $output = @$ipdat->geoplugin_countryName; break; case "countrycode": $output = @$ipdat->geoplugin_countryCode; break; } } } return $output; }
本插件费用请参考 /aboutfee
在95epay后台 需要设置返回网址为ec后台的返回网址 ,而不是ec后台 付款结果接收地址,切记 (比如 http://域名/respond.php?code=epay95 )
修改 api\message\include\Client.php
里面的sendsms函数
function sendSMS($mobiles=array(),$content,$sendTime='',$addSerial='',$charset='GBK',$priority=5,$smsId=8888) { $params = array('arg0'=>$this->serialNumber,'arg1'=>$this->sessionKey,'arg2'=>$sendTime, 'arg4'=>$content,'arg5'=>$addSerial, 'arg6'=>$charset,'arg7'=>$priority,'arg8'=>$smsId ); /** * 多个号码发送的xml内容格式是 * 159xxxxxxxx * 159xxxxxxx2 * .... * 所以需要下面的单独处理 * */ foreach($mobiles as $mobile) { //array_push($params,new soapval("arg3",false,$mobile)); //此处 } //$result = $this->soap->call("sendSMS",$params,$this->namespace); return $result; }
首先此文甚好 http://down.chinaz.com/try/201208/2176_2.htm
需要注意的是phpcms 后台配置需要指明数据库的名字。
另外查看我之前的博文来解决在 phpcms 退出后不发出js通知到ucenter的各个系统。
如果需要在phpcms注册时候自动登陆到ucenter的discuz系统,还需要看这个博文
关于ucenter各个应用如何最快捷知道所有的app,看这里