随笔分类 - PHP
摘要:<?phpclass Chs_to_En { function Pinyin($_String, $_Code = 'GBK') { $_DataKey = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha" . "|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|chuai|chuan|chuang|chu
阅读全文
摘要:"; $cache_str = $cache_str_begin . $cache_str_middle . $cache_str_end; // 缓存文件路径 $cache_file = "$cache_dir/$name$cache_extension"; if ($fp = @fopen ( $cache_file, "wb" )) { fwrite ( $fp, $cache_str ); fclose ( $fp ); return true; } else { echo $cach...
阅读全文
摘要:t1.php<?php// 方法一根据模版生成静态页面// replaceTemplateString函数用于替换模板中指定字符串function replaceTemplateString($templateString) { // 用来替换的变量 $title = "文章标题"; $body = "这里是文章主体"; // 替换模板中指定字符串 $showString = str_replace ( "%title%", $title, $templateString ); $showString = str_replace
阅读全文
摘要:<?phpecho implode ( ",", HexToRGB ( "#F7F7DA" ) ) . "<br/>";echo RGBToHex ( "rgb(247,247,218)" )?><?phpfunction HexToRGB($colour) { if ($colour [0] == '#') { $colour = substr ( $colour, 1 ); } if (strlen ( $colour ) == 6) { list ( $r, $g
阅读全文
摘要:<?php/*在根目录 -> wp-content -> themes 下创建mytheme文件夹用来存放创建新主题模板在mytheme目录下创建 index.php ,style.css 两个文件,在wp后台 外观->主题 中就可以看到刚创建的主题打开style.css文件输入*/?>/*Theme Name: 这里填主题名称Theme URI: 这里填主题介绍的网址,没有就填你的博客网址吧Description:这里填主题的简短介绍Author: 作者名Author URI: 作者的网址Version: 版本号Tags: 标签,多个用半角逗号隔开*/<?
阅读全文
摘要:<?php/*本文章是在网上搜寻其他关于wordpress创建插件文章并亲自实践总结而来的代码。参考文章网址有 http://www.ashuwp.com/courses/level/optionpage 很好的教程,简单易懂http://www.akasuna.com/2010/10/20/how-to-develop-a-plug-in/ 也是一篇不错的文章在根目录下 wp-content/plugins 新建存放新建插件文件夹 my_wp_pluginmy_wp_plugin 中新建 my_wp_plugin.php 文件内容:*//*Plugin Name: 插件名称Plugin
阅读全文
摘要:<?phpdefine('NUM_BIG_BLOCK_DEPOT_BLOCKS_POS', 0x2c);define('SMALL_BLOCK_DEPOT_BLOCK_POS', 0x3c);define('ROOT_START_BLOCK_POS', 0x30);define('BIG_BLOCK_SIZE', 0x200);define('SMALL_BLOCK_SIZE', 0x40);define('EXTENSION_BLOCK_POS', 0x44);define('NUM
阅读全文
摘要:<?php/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: *//*** A class for reading Microsoft Excel Spreadsheets.** Originally developed by Vadim Tkachenko under the name PHPExcelReader.* (http://sourceforge.net/projects/phpexcelreader)* Based on the Java version by Andy Khan (http://www.
阅读全文
摘要:_ole =& new OLERead(); 替换成 $this->_ole = new OLERead();*/require_once 'Excel/reader.php';//需要读取 excel 的页面引用 reader.php 文件$excel_data = new Spreadsheet_Excel_Reader ();//实例化一个读取excel对象$excel_data->setOutputEncoding ( 'utf-8' );//赋编码格式//连接数据库$conn = mysql_connect ( 'local
阅读全文
摘要:<?php//php需要开启ssl(OpenSSL)支持$apnsCert = "ck.pem";//连接到APNS时的证书许可文件,证书需格外按要求创建$pass = "123456";//证书口令$serverUrl = "ssl://gateway.sandbox.push.apple.com:2195";//push服务器,这里是开发测试服务器$deviceToken = "a8fcd4aa8943b223d4ebcd54fe168a8b99b3f24c63dbc0612db25a8c0a588675"
阅读全文
摘要:<?php$dir = "testFile";//假设当前页面同目录下有testFile文件夹//方式1$dirSource = opendir($dir);while ($childFileName = readdir($dirSource)) { if (!strcmp($childFileName, ".") || !strcmp($childFileName, "..")) {//排除testFile文件夹下最开始的 "."和".."两个文件名 continue; } echo $
阅读全文
摘要:duDaoRuConfig.php页面<?php$db_name="wordpress";//如需更改数据库配置在此更改即可$conn = mysql_connect("localhost", "root", "root");mysql_select_db($db_name, $conn);mysql_query("set names 'UTF-8'");//解析csv文件,返回二维数组,第一维是一共有多少行csv数据,第二维是键名为csv列名,值为当前行当前列的csv数据
阅读全文
摘要:1.从 http://glob.com.au/sendmail/ 下载sendmail.zip2.解压到 D:\ApacheServer\php\sendmail 最好短路径,长路径名有可能产生问题。3.php.ini配置SMTP = smtp.126.comsendmail_from = zdy_521@126.comsendmail_path = "D:\ApacheServer\php\sendmail\sendmail.exe -t"4.D:\ApacheServer\php\sendmail路径下sendmail.ini配置smtp_server=smtp.126
阅读全文
摘要:控制类文件都放在application/controllers/文件夹下面类名要和类文件名相同(类名开头大写,文件开头可以小写)控制类要继承CI_Controller类事例application/controllers/news.php文件:<?phpclass News extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('news_model');//引入某个数据库控制类 } public fun...
阅读全文
摘要:"; die('no'); } //===============判断文件存不存在 if (file_exists($file) == false) { echo ""; die('no file'); } //======================================================读取文件内容 //方法一 $dataString ...
阅读全文
摘要:0) { //如果上传错误打印错误 echo "error: " . $_FILES["file1"]["error"] . ""; } else { echo "name: " . $_FILES["file1"]["name"] . ""; echo "type: " . $_FILES["file1"]["type"...
阅读全文
摘要:<?php/*一、什么是smarty?smarty是一个使用PHP写出来的模板PHP模板引擎,它提供了逻辑与外在内容的分离,简单的讲,目的就是要使用PHP程序员同美工分离,使用的程序员改变程序的逻辑内容不会影响到美工的页面设计,美工重新修改页面不会影响到程序的程序逻辑,这在多人合作的项目中显的尤为重要。二、smarty优点:1. 速度:采用smarty编写的程序可以获得最大速度的提高,这一点是相对于其它的模板引擎技术而言的。2. 编译型:采用smarty编写的程序在运行时要编译成一个非模板技术的PHP文件,这个文件采用了PHP与HTML混合的方式,在下一次访问模板时将WEB请求直接转换到
阅读全文
摘要:PHP版本 windows版:http://windows.php.net/download/ 源码:http://php.net/downloads.php 新网址:https://windows.php.net/downloads/releases/archives/ 下载Thread Safe
阅读全文
摘要:<?php//数据库连接$conn = mysql_connect('localhost', 'root', '');mysql_select_db('test', $conn);mysql_query("SET NAMES GBK");/*支持事务的表必须是InnoDB类型一段事务中只能出现一次:mysql_query('START TRANSACTION');//开始事务mysql_query(' ROLLBACK ');//回滚事务mysql_query('C
阅读全文
摘要:here to see SID'; //=========================== index.php 页结束=========================== index2.php 页代码 //=========================== index2.php 页开始=========================== if ($_GET ["PHPSESSID"...
阅读全文