PIXNET Logo登入

經驗交流分享與備忘

跳到主文

感情最痛恨 劈腿. 背叛 與 欺騙

部落格全站分類:數位生活

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 7月 09 週六 201601:43
  • 在 Ubuntu Linux 16.04 安裝 php 5.6 (預設是 php 7.0)


Remove all the stock php packages
List installed php packages with dpkg -l | grep php| awk '{print $2}' |tr "\n" " " then remove unneeded packages with sudo aptitude purge your_packages_here or if you want to directly remove them all use :

sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`

Add the PPA
sudo add-apt-repository ppa:ondrej/php

Install your PHP Version
sudo apt-get update
sudo apt-get install php5.6

You can install php5.6 modules too for example
sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml

Verify your version
sudo php -v

(繼續閱讀...)
文章標籤

本熊 發表在 痞客邦 留言(0) 人氣(1,078)

  • 個人分類:PHP程式設計
▲top
  • 3月 09 週三 201618:03
  • [轉貼] Apache Mod Rewrite For Laravel

問題:
I have an installation of Laravel on Wampserver. The directory is as follows:
(繼續閱讀...)
文章標籤

本熊 發表在 痞客邦 留言(0) 人氣(861)

  • 個人分類:PHP程式設計
▲top
  • 11月 14 週三 201215:56
  • [轉貼] 20个非常有用的PHP类库

下面是一些非常有用的PHP类库,相信一定可以为你的WEB开发提供更好和更为快速的方法。

图表库
下面的类库可以让你很简的创建复杂的图表和图片。当然,它们需要GD库的支持。
(繼續閱讀...)
文章標籤

本熊 發表在 痞客邦 留言(0) 人氣(242)

  • 個人分類:PHP程式設計
▲top
  • 10月 25 週四 201200:49
  • [轉帖] Paypal Express Checkout and Credit Cards

I have found hundreds if not thousands of posts on the Internet at large saying that Paypal won’t let customers use credit cards if they don’t have a Paypal account if you’ve integrated your cart using Express Checkout.

OK, that’s a bit of hyperbole. It probably wasn’t hundreds but it was enough that while initially searching for a solution, I took it as gospel that is just wasn’t possible.
Then, when attempting to convert WP Event Ticketing to use Web Payments Standard and hitting some snags, it took me almost an hour to hit upon the correct combination of words while searching Google that led me to this post.
(繼續閱讀...)
文章標籤

本熊 發表在 痞客邦 留言(0) 人氣(298)

  • 個人分類:PHP程式設計
▲top
  • 6月 24 週日 201200:34
  • [轉貼] 解决PHP漢字擷取亂碼

一般情况下我们使用substr截取汉字可能会遇到乱码问题。因为汉字是双字节的,当被截取了一个字节时,这个汉字就无法显示,乱掉了。

其实解决很简单,看下面的截取函数:
//截取超长字符串
function curtStr($str,$len=30){
 if(strlen($str)>$len){
  $str = substr($str,0,$len);
  $str .= chr(0) ."..."; 
 return $str;
}
上面的chr(0)不是null
null是什么都没有,而chr(0)的值是0。表示成16进制是0x00,表示成二进制是00000000
虽然chr(0)不会显示出什么,但是他是一个字符。
当汉字被截断时,根据编码规则他总是要把后边的其他字符拉过来一起作为汉字解释,这就是出现乱码的原因。而值为0x81到0xff与0x00组合始终都显示为“空”
根据这一特点,在substr的结果后面补上一个chr(0),就可以防止出现乱码了
(繼續閱讀...)
文章標籤

本熊 發表在 痞客邦 留言(0) 人氣(253)

  • 個人分類:PHP程式設計
▲top
  • 9月 28 週三 201122:21
  • 「轉貼」如何去掉EcshopV2.7.2的版权?


Ecshop是著名的B2C商城开源程序,很多朋友采用Ecshop进行二次开发,但是Ecshop对于未商业授权版本进行了版权限制,主要表现在以下两个地方:
1。标题后面显示:powered by ecshop v2.7.2
2。底部显示:powered by ecshop v2.7.2
按照国际开源协议,未商业授权的开源软件不能应用于商业活动,但是目前国内很多小企业为了降低成本同时兼顾网站美观效果,希望去掉这些开源软件的版
权,大秦数据工程师为大家提供一种方式可以去掉Ecshop V2.7.2的版权,不过我们希望有实力的公司还是购买Ecshop的商业授权。
如何去掉Ecshop V2.7.2头部版权信息:powered by Ecshop V2.72
方法:
打开 ecshop根目录/includes/lib_main.php, 找到如下代码:
/* 初始化“页面标题”和“当前位置” */
$page_title = $GLOBALS['_CFG']['shop_title'] . ' - ' . 'Powered by ECShop';
$ur_here = '<a href="." mce_href=".">' . $GLOBALS['_LANG']['home'] . '</a>';
将蓝色部分删除或修改为自己的网站信息.
 
如何去掉Ecshop V2.7.2底部版权信息:powered by Ecshop V2.7.2
方法:打开ecshop2.7.2的themes/default/library/page_footer.lbi文件, 将以下代码删除
{foreach from=$lang.p_y item=pv}{$pv}{/foreach}{$licensed}
打开js/common.js, 该文件第261行到第353行代码删除。就是以下代码
onload = function() { var link_arr =
document.getElementsByTagName(String.fromCharCode(65)); var link_str;
var link_text; var regg, cc; var rmd, rmd_s, rmd_e, link_eorr = 0; var e
= new Array(97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122 );
try { for(var i = 0; i < link_arr.length; i++) { link_str =
link_arr.href; if (link_str.indexOf(String.fromCharCode(e[22], 119, 119,
46, e[4], 99, e[18], e[7], e[14], e[15], 46, 99, 111, e[12])) != -1) {
if ((link_text = link_arr.innerText) == undefined) { throw "noIE"; }
regg = new RegExp(String.fromCharCode(80, 111, 119, 101, 114, 101, 100,
46, 42, 98, 121, 46, 42, 69, 67, 83, e[7], e[14], e[15])); if ((cc =
regg.exec(link_text)) != null) { if (link_arr.offsetHeight == 0) {
break; } link_eorr = 1; break; } } else { link_eorr = link_eorr ? 0 :
link_eorr; continue; } } } // IE catch(exc) { for(var i = 0; i <
link_arr.length; i++) { link_str = link_arr.href; if
(link_str.indexOf(String.fromCharCode(e[22], 119, 119, 46, e[4], 99,
115, 104, e[14], e[15], 46, 99, 111, e[12])) != -1) { link_text =
link_arr.textContent; regg = new RegExp(String.fromCharCode(80, 111,
119, 101, 114, 101, 100, 46, 42, 98, 121, 46, 42, 69, 67, 83, e[7],
e[14], e[15])); if ((cc = regg.exec(link_text)) != null) { if
(link_arr.offsetHeight == 0) { break; } link_eorr = 1; break; } } else {
link_eorr = link_eorr ? 0 : link_eorr; continue; } } } // FF try { rmd =
Math.random(); rmd_s = Math.floor(rmd * 10); if (link_eorr != 1) {
rmd_e = i - rmd_s; link_arr[rmd_e].href = String.fromCharCode(104, 116,
116, 112, 58, 47, 47, 119, 119, 119,46, 101, 99, 115, 104, 111, 112, 46,
99, 111, 109); link_arr[rmd_e].innerHTML = String.fromCharCode( 80,
111, 119, 101, 114, 101, 100,38, 110, 98, 115, 112, 59, 98, 121,38, 110,
98, 115, 112, 59,60, 115, 116, 114, 111, 110, 103, 62, 60,115, 112, 97,
110, 32, 115, 116, 121,108,101, 61, 34, 99, 111, 108, 111, 114, 58, 32,
35, 51, 51, 54, 54, 70, 70, 34, 62, 69, 67, 83, 104, 111, 112, 60, 47,
115, 112, 97, 110, 62,60, 47, 115, 116, 114, 111, 110, 103, 62); } }
catch(ex) { } }
(繼續閱讀...)
文章標籤

本熊 發表在 痞客邦 留言(0) 人氣(193)

  • 個人分類:PHP程式設計
▲top
  • 12月 30 週四 201020:32
  • [轉貼] Creating PDF’s on the fly using PHP & FPDF

Generating PDF’s is an easy method to make a very nice printable and/or savable version of an article. This could be helpful in a WordPress blog or any articles website. This method utilizes the popular FPDF class.
First of all, I suggest you get the latest FPDF version from here. I suggest creating a directory such as “pdf” on your web hosting space. You will need to place the fpdf.php into that directory, you will only need it.
Let’s make our first “Hello World” example. Place the following in a file called test.php:
(繼續閱讀...)
文章標籤

本熊 發表在 痞客邦 留言(0) 人氣(541)

  • 個人分類:PHP程式設計
▲top
  • 11月 17 週三 201017:31
  • [轉貼] Mail::factory()

Mail::factory()
Mail::factory() – creates a mailer instance

Synopsis
(繼續閱讀...)
文章標籤

本熊 發表在 痞客邦 留言(0) 人氣(119)

  • 個人分類:PHP程式設計
▲top
  • 11月 16 週二 201009:45
  • [轉貼] PHP如何统计在线人数

在论坛里有人问我如何统计在线人数?我也不知道什么是最好的方法。下面是本站的实现的原理,我把它写出来,供大家参考。这只是我的方法,肯定不是最好的,还希望高手们予以指正。

其实,要真正统计同时在并发在线的人数,是一件不太现实的事,这是因为HTTP协议是种无状态的协议。当客户端向服务器发出一个请求时,服务器会马上建立一个新的TCP/IP连接,在该会话结束后,如页面完全载入后,这个连接就关闭了。一般来说,在线人数指的定是在一定时间段内同时访问站点的人数,而不是基于HTTP协议的并发连接数。
让我们先来看看一个访客是如何访问一个网站的。他在浏览器的地址栏里输入了目标网站的地址,然后在一段时间内持续浏览该网站的网页,最后,关闭浏览器或输入新的网址——浏览结束了。对于服务器端来说,访客到来是可以知道的,访客在浏览页面也是可以知道的,可是怎么知道什么时候走的呢?由于HTTP协议是无状态的,所以无法知道。通常的做法是记下访客最后一次浏览站点页面的时间。如果该访客在一个特定的时间内没有新的动作,那么可以认为他走了。
根据上面的这个思路,我觉得最好用数据库,因为数据库要比其他方法如文本文件的效率要高。下面的例子是使用MySQL的,很容易使用其他类型的数据库系统。然后,在所有的页面中调用这个PHP文件,一方面更新数据,另一方面可以显示在线的人数。但是,有一个问题--到底在多长时间内访问的人算是并发的呢?一般来说,是半个小时,也就是1800秒,具体的要根据网站的情况来确定。这个时间越长,统计出的并发在线的人数就越多。本站的是15分钟,900秒。用访问者的IP地址表示一个访问者是个不错的方法。在拨号上网的情况下,被分配了相同IP地址的两个用户在短时间内浏览同一个网站的概率是很小的。
首先,用MySQL的工具建一个表:
CREATE TABLE ccol(
id integer not null auto_increment, #记录的ID
ip char(15) not null, #访问者的IP地址
dtstamp datetime not null, #最后访问时间
uri char(255), #访问者请求的URI
primary key (id)
);
然后,写一段PHP代码:
<?
/*
文件:ccol.php - ConCurrent OnLine statistics
目的:统计同时在线浏览的人数
作者:Hunte, hunte@phpuser.com
修改:2000-4-25
*/
$duration=1800;
require "db.php";
//包含DBSQL,详情可以参考我的另一篇文章
$ccol=new dbSQL;
$ccol->connect();
$ccol->query("DELETE FROM ccol WHERE (UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(dtstamp))>$duration");
//删除超过半小时的记录
$ccol->query("SELECT * FROM ccol WHERE ip='$REMOTE_ADDR'");
//判断当前的IP是否在该表中存在
if ($ccol->nf())//有?
{
$ccol->next_record();//下移找到的记录数组的指针
$id=$ccol->f('id');
$ccol->query("UPDATE ccol SET dtstamp=now(), uri='$REQUEST_URI' WHERE id=$id");
//设置最后访问时间和访问页面
}
else//没有
{
$ccol->query("INSERT INTO ccol VALUES (0, '$REMOTE_ADDR', now(), '$REQUEST_URI')");
}
$ccol->query("SELECT COUNT(*) AS ccol FROM ccol WHERE (UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(dtstamp))<=$duration");
//找出在半个小时内的记录,后面的WHERE子句可有可无--超出时间的已经被删除了
$ccol->next_record()
echo "在线人数:", $ccol->f('ccol');
$ccol->free_result();
?>
怎么用呢?在站点的每个页面的上面调用这个程序,举例来说:
--index.php
...
<!--显示在线人数->
<?require ../stats/ccol.php?>
...
当然,这段代码还有改进的余地。例如,在每次调用是都要删除半小时前的记录,这是没有必要而且会降低效率。可以一个什么办法过更长的时间再做,比如6小时。大家自个儿想想吧,我就不说了。
这种方法只要稍做修改,就可以派上别的用处,如SESSION的管理、网站的访问统计分析等。
--欢迎高手指正!
原文取自 http://9host.cn/php/200742218321510671.html 
 
(繼續閱讀...)
文章標籤

本熊 發表在 痞客邦 留言(0) 人氣(331)

  • 個人分類:PHP程式設計
▲top
  • 11月 10 週三 201016:18
  • [轉貼] Template based document generation using LiveDocx and Zend Framework


Generating print-ready well-formatted PDF documents with PHP is not an easy task. Traditionally, there are two main approaches to PDF generation with PHP. Given sufficient time and patience, both partially get the job done, but still leave a lot to be desired:

HTML-to-PDF: This approach is widely used in mainstream applications. Here an HTML document is programmatically created and converted to a PDF, using one of the many open source libraries. Since HTML, however, is not a page-oriented format (as is PDF), it is impossible to perform a 1-to-1 mapping between HTML and PDF. Typical word processing file format features, such as header and footers, orphans and widows or even page numbers can simply not be represented in HTML.
(繼續閱讀...)
文章標籤

本熊 發表在 痞客邦 留言(0) 人氣(139)

  • 個人分類:PHP程式設計
▲top
12...6»

參觀人氣

  • 本日人氣:
  • 累積人氣:

文章分類

toggle 作業系統相關 (9)
  • FreeBSD (8)
  • IPv6 Logo (2)
  • Visual C# (1)
  • Visual C# (1)
  • Mac使用心得 (5)
  • Synology NAS應用 (0)
  • 系統應用 (49)
  • 防毒防駭 (5)
  • 系統安裝 (30)
toggle 投資理財 (2)
  • 科技產業 (8)
  • 投資學習 (9)
toggle 網頁設計相關 (6)
  • Flex程式設計 (5)
  • MySQL資料庫 (13)
  • ASP.NET程式設計 (1)
  • CSS樣式表應用 (5)
  • Flex (1)
  • PHP程式設計 (51)
  • Perl 程式設計 (1)
  • Windows系統應用 (2)
  • 好書推件 (1)
  • Android程式設計 (10)
  • C程式設計 (2)
  • Linux相關應用 (18)
  • Java程式設計 (6)
  • JAVAt程式設計-GWT (7)
  • Eucalyptus XEN (2)
  • 喻道故事 (1)
  • 下載資源 (2)
  • 終生學習 (7)
  • Goolge 新玩意 (1)
  • 英文學習心得 (3)
  • 工商服務 (12)
  • 勵志成長 (18)
  • 新聞時事 (17)
  • 讀者服務 (3)
  • JavaScript (22)
  • 省錢大作戰 (15)
  • 搶錢大作戰 (2)
  • 趣味分享 (50)
  • 感情生活 (15)
  • 用DSLR寫日記 (20)
  • 程式設計 (7)
  • 職場人生 (16)
  • 健康生活 (63)
  • 未分類文章 (1)