部落格文章訂閱


貧窮不能等,因為時間久了,你就會貧窮習慣了;
夢想不能等,因為努力晚了,人老就無能為力了;
學習不能等,因為懂得少了,就沒本事夢想成真了;
健康不能等,因為身體垮了,人生的一切就都沒了。


自訂搜尋

找不到想要的文章嗎? 請直接再下面的搜尋框裡輸入要查詢文章內容關鍵字 ,就能夠更快速的取得想要閱讀的問題喔~~謝謝大家的支持與愛護~若有任何建議事項, 歡迎透過留言板留言給我喔!!


  • 你不能決定生命的長度,但可以控制它的寬度;
  • 你不能左右天氣,但可以改變心情;
  • 你不能改變容顏,但可以展現笑容;
  • 你不能控制他人,但可以掌握自己;
  • 你不能預知明天,但可以利用今天;
  • 你不能樣樣勝利,但可以事事盡力。

free counters

目前分類:PHP程式設計 (51)

瀏覽方式: 標題列表 簡短摘要

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

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

問題:

I have an installation of Laravel on Wampserver. The directory is as follows:

C:\wamp\www\laravel

Now URLs are like this:

http://localhost/laravel/public/index.php/home/index

文章標籤

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

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

图表库

下面的类库可以让你很简的创建复杂的图表和图片。当然,它们需要GD库的支持。

pChart - 一个可以创建统计图的库。

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

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.

The relevant information is this

文章標籤

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

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

其实解决很简单,看下面的截取函数:

//截取超长字符串
function curtStr($str,$len=30){

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

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

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

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:

<?php

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

Mail::factory()

Mail::factory() – creates a mailer instance

Synopsis

require_once 'Mail.php';

object &factory ( string $backend , array $params = array() )

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

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

其实,要真正统计同时在并发在线的人数,是一件不太现实的事,这是因为HTTP协议是种无状态的协议。当客户端向服务器发出一个请求时,服务器会马上建立一个新的TCP/IP连接,在该会话结束后,如页面完全载入后,这个连接就关闭了。一般来说,在线人数指的定是在一定时间段内同时访问站点的人数,而不是基于HTTP协议的并发连接数。

让我们先来看看一个访客是如何访问一个网站的。他在浏览器的地址栏里输入了目标网站的地址,然后在一段时间内持续浏览该网站的网页,最后,关闭浏览器或输入新的网址——浏览结束了。对于服务器端来说,访客到来是可以知道的,访客在浏览页面也是可以知道的,可是怎么知道什么时候走的呢?由于HTTP协议是无状态的,所以无法知道。通常的做法是记下访客最后一次浏览站点页面的时间。如果该访客在一个特定的时间内没有新的动作,那么可以认为他走了。

根据上面的这个思路,我觉得最好用数据库,因为数据库要比其他方法如文本文件的效率要高。下面的例子是使用MySQL的,很容易使用其他类型的数据库系统。然后,在所有的页面中调用这个PHP文件,一方面更新数据,另一方面可以显示在线的人数。但是,有一个问题--到底在多长时间内访问的人算是并发的呢?一般来说,是半个小时,也就是1800秒,具体的要根据网站的情况来确定。这个时间越长,统计出的并发在线的人数就越多。本站的是15分钟,900秒。用访问者的IP地址表示一个访问者是个不错的方法。在拨号上网的情况下,被分配了相同IP地址的两个用户在短时间内浏览同一个网站的概率是很小的。

首先,用MySQL的工具建一个表:

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

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.

Programmatic: This approach offers total control of the resulting PDF. However, it requires that the x and y coordinates of every line of text, every geometrical shape and graphic be set from program code. Not only is this an extremely time-consuming solution, but is also very brittle: Every time a graphical designer changes the layout of a document, a programmer must re-work his or her program code.

A completely new approach

In this article, the author presents an entirely new, third approach. It relies on templates being created in a WYSIWYG environment, such as Microsoft® Word or Open Office, and then being populated with data in PHP. The resulting document can be saved not only to PDF, but also DOCX, DOC and RTF.

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

The goal of the LiveDocx Zend Framework component phpLiveDocx is to make the interaction with the backend SOAP service LiveDocx as simple and as native to PHP as possible. phpLiveDocx embodies the KISS principle of the Zend Framework.

Technically, however, it is possible to instantiate and interact with the SOAP service directly from PHP. PHP 5 ships with the excellent SoapClient, which offers almost all the functionality that is required.

Checking for the SOAP extension

Although the SOAP extension is available on most PHP 5 installations, it is possible to disable it. To ensure you have the SOAP extension installed and enabled, take a look at the output of echo phpinfo();. If you see the following section, you are good to go.

PHP 5 Soap extension

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

This article offers a second approach to using LiveDocx in PHP without the Zend Framework. This one does not require the PHP 5 SOAP extension, but does require the SOAP library NuSOAP.

The majority of the code on this page was contributed by Mats Andersson. He took the original code and ported it to work with NuSOAP. A big thank you goes out for his work!

Download and install NuSOAP

Visit the NuSOAP homepage and download the current version of NuSOAP. For the purpose of this article, we are using v0.7.3. Your mileage may vary for other versions. Then, set the include path (see line, containing set_include_path()) to the path in which NuSOAP is installed.

Download templates

Once you have the libraries in place, download the following template files. They are used by the sample applications:

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

Question :

I am written some jQuery ajax code where I am sending a request to the server when a drop down option is changed. Based on this change 4 or 5 text fields change their data and bunch of new images get loaded. everything feels nifty.

But I was wondering if there was a plugin provided by jquery that would make the page dark...show 'loading' or spinner for a quick second until request comes back from the server? I remember seeing one around but am not able to find it.

Answer:

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

Recently I had a development client which as part of a larger system had a requirement of creating a PDF based report from his clients metrics, KPI’s etc. which he could then forward onto them. It was simple numerical data but for presentation purposes it was needed in PDF… you know to look good.

In the past when budget was less of an issue I used PDFLib, a commercial library which these days is available as part of the core PHP package. This project however required me to look for a free alternative. I found TCPDF on Sourceforge. It had almost 80,000 downloads, good documentation, lots of examples and was being used by applications such as Joomla, Drupal, Moodle and phpMyAdmin so I said I’d give it a go.

Installation was easy, basically I just needed to copy the TCPDF folder to my www space and require() the main class file from PHP scripts that needed to create PDFs on the fly.

I have to say I found it quite a slow & tedious process to create the more complex dynamic PDFs with this library, however this is because of what I was trying to do in the overall sense and was not the libraries ‘fault’, after all creating PDFs dynamically is quite different than creating webpages dynamically. I found having to work out all the ‘maths’ for positioning elements and the fact you can’t just press refresh to see if your latest line or two outputted as intended the most frustrating.  

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

There has been a lot of talk about Zend Framework 2.0 in the past few weeks. One of the major new features is the consistent use of namespaces through out the framework. This requires that all components be re-written to take advantage of this PHP 5.3 feature.

Although the release of Zend Framework 2.0 is a long way off — currently there is no official release plan — contributors are encouraged to port their components as soon as possible.

Therefore, I am delighted to announce that you can download a version of \Zend\Service\LiveDocx, complete with the latest development version of Zend Framework 2.0 from my account at GitHub.

In particular, take a look at the shipped demo applications, in the directory /demos/Zend/Service/LiveDocx. They illustrate how to use all parts of the framework and offer a good introduction to the usage of namespaces in PHP 5.3, if this topic is new to you.

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

Since the initial release of phpLiveDocx last week, one of the most common questions that I keep receiving via e-mail is:

How can I convert DOC to PDF in PHP?

Although it was not the original intention of phpLiveDocx to offer such file format conversion, it is very possible. In this post, I would like to present a little class, which does exactly that.

In a future version of phpLiveDocx, there will be an additional component called Tis_Service_LiveDocx_Convert, which will offer a more efficient method of document conversion. When this version is released, it will make redundant the code in this post, but until then, here is a really easy way to convert DOC to PDF in PHP.

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

http頭狀態信息及php header設置詳述

// ok
header('HTTP/1.1 200 OK');
  
//設置一個404頭:
header('HTTP/1.1 404 Not Found');

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

学习BPEL,有个有名的开源引擎ActiveBEPL(http://www.active-endpoints.com),于是进入这个站点搜索些资料。在浏览中发现网页上有很多这种字符“ActiveBPEL™”,这个TM的样式非常的怪,是怎么实现的呢?我用firebug查看了下它的代码,也仅仅是“TM”两个字符。我又用IE Inspector查看了,是“? ”。这就更怪了,竟然不一样。后来又在一页的title上发现了这些字符,于是查看了下源代码。“ActiveBPEL&trade;”&trade;是什么,google一下。呵呵,原来是HTML的一个特殊字符而已。写了这么多年的HTML,竟然不知道,惭愧啊!

想表达的意图 处理方式
(回车换行) <br>
 (空格符) &nbsp;
&(AND符号) &amp;
<(左尖括号、小于号) &lt;
>(右尖括号、大于号) &gt;
°(度) &deg;
•(间隔符)
´ &acute;
" &quot;
&ldquo;
&rdquo;
&permil;
&larr;
&uarr;
&rarr;
&darr;
&harr;
&radic;
&prop;
&infin;
&ang;
&and;
&or;
&cap;
&cup;
Ø &Oslash;
&int;
&there4;
&asymp;
¥(RMB) &yen;

想表达的意图 处理方式
&ne;
&equiv;
&le;
&ge;
&oplus;
λ &lambda;
μ &mu;
ν &nu;
ξ &xi;
ν &nu;
ξ &xi;
&prod;
&sum;
¥ &yen;
¹(一次方符号) &sup1;
²(平方符号) &sup2;
³(立方符号) &sup3;
nr(上标情形) n<sup>r</sup>
Ci(下标情形) C<sub>i</sub>
加粗 <b>加粗</b>
斜体 <i>斜体</i>
下划线 <u>下划线</u>
±(加减符号) &plusmn;
×(乘法符号) &times;
÷(除法符号) &divide;
©(版权所有) &copy;
®(注册商标) &reg;
™(商标符号) &trade;
—(破折号)

全文轉貼自 http://blog.chinaunix.net/u2/73798/showart_1084792.html 


Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

由於utf8編碼有固定格式,其可能有2~4個字節,我們可以將每一個字節拆開判斷
這個函示僅判斷每個中文字的第一個字節,應該夠了。

請參考 wikipedia 之 UTF8 說明 ,網址 http://zh.wikipedia.org/zh-tw/UTF8

//判斷字串是否為utf8

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

若不是透過 yum 或 aptitude 安裝的 PHP 執行環境 ,而是透過 PHP Source 自行組態 configure 然後 make, make install 所編成的 PHP 執行環境, 則在讓 PHP支援 mb_string 時 , PHP 4 v.s PHP 5 在執行 configure 的參數有差異, 請參考以下內容 (取自PHP官方網站)

mbstring is a non-default extension. This means it is not enabled by default. You must explicitly enable the module with the configure option. See the Install section for details.

The following configure options are related to the mbstring module.

 

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()

1 23
找更多相關文章與討論