This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Pdo MySql driver wrap | |
* | |
* @category Class | |
* @package Fasthold Own PHP Snippet | |
* @copyright Copyright (c) 2007 | |
* @license New BSD License | |
* @author Fasthold Lau ([email protected]) | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * , IF( `Word` = 'sim', 1, IF( `Word` LIKE 'sim%', 2, IF( `Word` LIKE '%sim', 4, 3 ) ) ) AS `sort` FROM `dblist` WHERE `Word` LIKE '%sim%' ORDER BY `sort` , `Word` | |
# 得到结果: | |
1. sim | |
2. sim* | |
3. *sim* | |
4. sim* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$mongo = new Mongo(); | |
$db = $mongo->selectDb('firv_exam'); | |
// 要查询的collection | |
$collection = 'question'; | |
// 构造 map 和 reduce 函数 | |
$map = <<<MAP | |
function() { emit(this.username,1); } // this.username 相当于 sql 里的 group by username |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<phpunit bootstrap="./TestHelper.php" colors="true"> | |
<!-- Version: $Id$ --> | |
<testsuite name="Zend Framework Unit Test Demo"> | |
<directory>./</directory> | |
</testsuite> | |
<filter> | |
<whitelist> | |
<directory suffix=".php">../library/</directory> | |
<directory suffix=".php">../application/</directory> |
NewerOlder