Dompdf for PHP & Replace Url to link
If you want to put some big table in the pdf file, you may got the layout messy. One way to solve the problem is to change the paper size. In "includes/cpdf_adapter.cls.php", Change the size you used in the array to whatever you want.
One tip: Replace Url into Clickable link.
$text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href="\" mce_href="\""\\0\" rel=\"nofollow\">\\0</a>", $text);
It may look like gibberish at first, but if you look at it for awhile, you might be able to guess what it does.
Suppose you’re writing a PHP script that displays data, let’s use
blog comments as an example. Sometimes the data being displayed may
have a URL pasted into it by the user that submitted it. Wouldn’t it be
nicer for the end user if URLs like that were automatically turned into
clickable links, so “http://google.com” would become “http://google.com
?”
That’s exactly what this line of PHP code does. It takes the variable $text
and parses through it, converting stray URLs into clickable links.
相关文档:
仿GOOGLE和Discuz分页函数(php)
这个函数只需要2个参数 当前页码和总页数,$site是路径,文件名可以按自己的需要修改
这个函数不能传递其他参数,如果要传递其他参数,在函数里自己加一个参数就行了
<?php
//计数
$sql = “SELECT count(*) from `andycms_title`;”;
$numrs = mysql_query($sql) or ......
1、PHP4以后获取传值的方法
一般在页面中传值常见的是POST、GET和COOKIE几种,所以下面我也主要介绍这几种。PHP4以后都采用的是$_POST、$_GET等数组来获取网页传值。在PHP3.0及以下版本都是用的是$HTTP_POST_VARS、$HTTP_GET_VARS等数组,具体代码如下
echo $_POST['dopost'];
?>
< form action="weste_net.php" ......
先看看下边这段PHP代码。这段使用ip2long函数,对同一个IP进行转换。当然,也有人认为58.99.011.1和058.99.011.1算不上合法的
IP,那就Return,此文对你没有帮助。
为什么要使用带前导零的ip:为了在数据库中查询,这个可以在IP库中定位到ip所对应的位置信息。虽然没有整型的IP查询效率高,但毕竟直观啊。
<?php
ech ......
之前一直都是在服务器调试程序,有一天想弄到本地来,可死活就是连不上远程服务器了。
本地:windows+apache。
远程服务器:windows+ms sql 2008.
php和apache该配置的都配了,其他程序也可以运行,可就是连不上数据库。
苦苦寻觅 ......
1、古老的欺骗SQL语句
在默认模式下,即使是你忘了把php.ini拷到/usr/local/lib/php.ini下,php还是打开magic_quotes_gpc=on。
这样所有从GET/POST/Cookie来的变量的单引号(')、双引号(")、反斜杠backslash(\)以及空字元NUL
(the null byte)都会被加上反斜杠,以使数据库能够正确查询。
但是在php-4-RC2的时候引入 ......