l1n6yun's Blog

记录学习的技能和遇到的问题

0%

我们可以在 <script> 片断中定义一个被JS调用的代码,但代码又不在页面上显示,这时,我们可以使用下面的方法:

1
2
3
4
5
6
7
8
9
<script id="commentTemplate" type="text/html">
<li>
<div class="photo">
<a href="#"><img src="[UserImg]" /></a>
</div>
<p><a href="#">[UserName]:</a><span class="time">[CreateDate]</span></p>
<div class="clear"></div>
</li>
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<div id="comment_ul_2"></div>

<input type="button" id="addFun" value="click me" />

<script type="text/javascript">
var reg = new RegExp("\\[([^\\[\\]]*?)\\]", 'igm'); //i g m是指分别用于指定区分大小写的匹配、全局匹配和多行匹配。
$("#addFun").click(function () {
var html = document.getElementById("commentTemplate").innerHTML;
var source = html.replace(reg, function (node, key) { return { 'UserImg': '1', 'UserName': 'zhang', 'CreateDate': '2011-1-1'}[key]; });
$("#comment_ul_2").append(source);
});

var zzl = "name:[name]";
zzl = zzl.replace(reg, function (node, key) { return { 'name': '占占'}[key]; });
alert(zzl);
</script>

OK,这个意思是说,当你单击按钮时,可以把 commentTemplate 的内容追到 comment_ul_2 里,这很有意思吧,呵呵!

而其中有一个 replace ,也很有意思,向在替换时,可以接受一个 json 字符串,然后根据 json 的 key 来对比 js 模块里的 key ,进行赋值!

真的很有意思!

一款开源指纹识别工具。



开源工具使用说明:
-u 一个域名或IP,如果输入更多域名或IP使用‘,’分隔;
-r 读取本地域名或IP文件地址;
-t 输入一个线程数量,默认线程为50;
-p 设置一个请求端口,默认端口为80;
-s 设置一个请求协议,默认请求协议为http.(http、https);
-h 查看使用帮助;
-o 输出识别结果到本地文件;
-m 选择一个常规识别模式,默认使用模式为1;(1:快速识别一条指纹 2:获取命中率高的指纹 3:得到所有匹配的指纹)
–http-request 设置一个自定义请求URL;
–http-response 设置一个自定义关键字符。(支持正则表达式字符,自定义枚举指纹字符)
注:自定义识别模式参数为 –http-request /robots.txt –http-response discuz;不能和-m 常规识别模式一起使用。-u和-r参数不能同时使用。

  1. 使用-m参数选择常规识别模式,有3种可选模式。下面具体说明:
     -m 1:快速识别一条指纹,请求设置的url,获取相应识别方式的响应信息,进行数据库指纹遍历匹配,匹配到一条则跳出程序,显示识别结果。(速度较快)
     -m 2: 获取命中率高的指纹,例如请求url,进行指纹库全部遍历匹配,比如一个网址,命中了1个dedecms,2个 phpcms,1个discuz,那么显示的识别结果为phpcms程序。
     -m 3: 获取匹配识别所有的指纹信息,请求url获取响应信息,进行指纹库全部遍历匹配,最后获取指纹识别所有结果。(速度较慢、数据最全)
  2. 使用--http-request、--http-response参数自定义识别模式,下面具体说明:
     使用自定义识别模式应同时使用--http-request、--http-response两个参数,第一个参数设置为请求路径,第二个参数设置响应信息关键字符(支持正则表达式、不过注意大小写问题)
  
  例:java -jar Dayu.jar -r d:\\1.txt -t 100 --http-request / --http-response tomcat
      java -jar Dayu.jar -u www.discuz.net,www.dedecms.com -o d:\\result.txt
      java -jar Dayu.jar -u cn.wordpress.org -s https -p 443  -m 3
      

Dayu.jar程序说明:
Feature.json指纹文件放到D盘根目录(d:\Feature.json),如无D磁盘,请自行下载源码更改org.secbug.conf下Context.java文件中的currpath常量。

在此说明:
指纹识别离不开指纹库的强大。希望用户多多在我们平台 http://www.secbug.org:8080/ 提交指纹,我们一起进步。

  ☆☆ 本版本为第二版,第一版基于数据库sql文件,可保存指纹识别结果。如有需要,请联系QQ212125278所取。

https://github.com/Ms0x0/Dayu1

在 linux 下完整的用 wget 命令整站采集网站做镜像的命令是:

1
wget -m -e robots=off -U "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6" "http://www.example.com/"

wget命令参数注释:

-e robots=off #让 wget 耍流氓无视 robots.txt 协议

-U "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6" #伪造 agent 信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
class WS {
var $master; // 连接 server 的 client
var $sockets = array(); // 不同状态的 socket 管理
var $handshake = false; // 判断是否握手

function __construct($address, $port){
// 建立一个 socket 套接字
$this->master = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)
or die("socket_create() failed");
socket_set_option($this->master, SOL_SOCKET, SO_REUSEADDR, 1)
or die("socket_option() failed");
socket_bind($this->master, $address, $port)
or die("socket_bind() failed");
socket_listen($this->master, 2)
or die("socket_listen() failed");

$this->sockets[] = $this->master;

// debug
echo("Master socket : ".$this->master."\n");

while(true) {
//自动选择来消息的 socket 如果是握手 自动选择主机
$write = NULL;
$except = NULL;
socket_select($this->sockets, $write, $except, NULL);

foreach ($this->sockets as $socket) {
//连接主机的 client
if ($socket == $this->master){
$client = socket_accept($this->master);
if ($client < 0) {
// debug
echo "socket_accept() failed";
continue;
} else {
//connect($client);
array_push($this->sockets, $client);
echo "connect client\n";
}
} else {
$bytes = @socket_recv($socket,$buffer,2048,0);
print_r($buffer);
if($bytes == 0) return;
if (!$this->handshake) {
// 如果没有握手,先握手回应
$this->doHandShake($socket, $buffer);
echo "shakeHands\n";
} else {

// 如果已经握手,直接接受数据,并处理
$buffer = $this->decode($buffer);
//process($socket, $buffer);
echo "send file\n";
}
}
}
}
}

function dohandshake($socket, $req)
{
// 获取加密key
$acceptKey = $this->encry($req);
$upgrade = "HTTP/1.1 101 Switching Protocols\r\n" .
"Upgrade: websocket\r\n" .
"Connection: Upgrade\r\n" .
"Sec-WebSocket-Accept: " . $acceptKey . "\r\n" .
"\r\n";

echo "dohandshake ".$upgrade.chr(0);
// 写入socket
socket_write($socket,$upgrade.chr(0), strlen($upgrade.chr(0)));
// 标记握手已经成功,下次接受数据采用数据帧格式
$this->handshake = true;
}


function encry($req)
{
$key = $this->getKey($req);
$mask = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";

return base64_encode(sha1($key . '258EAFA5-E914-47DA-95CA-C5AB0DC85B11', true));
}

function getKey($req)
{
$key = null;
if (preg_match("/Sec-WebSocket-Key: (.*)\r\n/", $req, $match)) {
$key = $match[1];
}
return $key;
}

// 解析数据帧
function decode($buffer)
{
$len = $masks = $data = $decoded = null;
$len = ord($buffer[1]) & 127;

if ($len === 126) {
$masks = substr($buffer, 4, 4);
$data = substr($buffer, 8);
} else if ($len === 127) {
$masks = substr($buffer, 10, 4);
$data = substr($buffer, 14);
} else {
$masks = substr($buffer, 2, 4);
$data = substr($buffer, 6);
}
for ($index = 0; $index < strlen($data); $index++) {
$decoded .= $data[$index] ^ $masks[$index % 4];
}
return $decoded;
}

// 返回帧信息处理
function frame($s)
{
$a = str_split($s, 125);
if (count($a) == 1) {
return "\x81" . chr(strlen($a[0])) . $a[0];
}
$ns = "";
foreach ($a as $o) {
$ns .= "\x81" . chr(strlen($o)) . $o;
}
return $ns;
}

// 返回数据
function send($client, $msg)
{
$msg = $this->frame($msg);
socket_write($client, $msg, strlen($msg));
}
}

// 测试
$ws = new WS("127.0.0.1",2000);

纪念碑谷 2 上线 App Store 过去一天了,有不少朋友也已经迫不及待地下载并通关了。当然,其中也包括了 AppSo。

前天,AppSo(微信号 AppSo)简单地介绍了纪念碑谷 2,那么今天我们就为大家带来背后团队的采访和详细的评测吧。

它仍是我们喜欢的纪念碑谷

纪念碑谷原来的设计师 Ken Wong 已经离开了团队,回到了澳洲,所以这次的设计团队也是一个完全不一样的团队,有不少人担心它的游戏内核会不会发生变化。

纪念碑谷 2 延续了纪念碑谷 1 的玩法,你需要利用视错觉让主角走出迷宫。设计依旧以艺术家埃舍尔的创作为基础,利用了「潘洛斯三角」、「凹凸错觉」「二维三维的扭转变换」……画风延续之余,但剧情发生了较大的变化。

相信大家都记得第一代的纪念碑谷有着相对阴郁的剧情,它的主题是「宽恕」。而纪念碑谷 2 的基调就变得轻快起来——它探讨的是一个「亲子关系」的故事。

继前作的「艾达公主」之后,此次带领我们踏上旅程的是「罗尔」和她的孩子。在旅途中,你将帮助主角罗尔教导她的小孩。

极富想象力的场景,和无论色调、元素单一或复杂都至臻完美的画面,带来视听享受的同时,令我们倍感熟悉。

不同的是,这趟旅途少了孤单,多了陪伴。目的也不再是寻觅,而是互相扶持着携手并进。

孩子奔跑、跌倒,无力遥望坠落的母亲时,我们不免揪心。

当两人终于跨过险阻冲向终点时,我们深深感动。

剧情已经足够丰富,「纪念碑谷 2」却未就此停下。

关卡不断推进,冷静质朴的文字揭示了更为残忍的事实——孩子终将长大成人,伴随他们度过人生旅程的父母也将回归孤独,再度独自踏上旅程。

顺逆相随,让她羽翼自丰。
面对生命进程,我们不乏勇气,而是放手的决心。
你,终将继续完成属于自己的旅程。

这种安排无疑会令玩家怅然若失,却也成就了纪念碑谷 2 的超高人气。

然而,为什么会选择这样的故事?

见纪念碑谷团队的时候,是在一个布置温馨的小房间,游戏总监 Dan Gray 脸上带着轻松的笑容——纪念碑谷 2 如期成功上线,在 WWDC 上进行了一次短暂的亮相。

在采访前,我已经到达了第五章,而游戏总监 Dan Gray 看到则说:

Aha, you go far.

纪念碑谷 2 一共有 14 个关卡,耗费 15 个月完成,比起纪念碑谷少了 4 个关卡。而不少通关的朋友也表示,相对于纪念碑谷,纪念碑谷 2 的难度有所降低,但依旧精美。

纪念碑谷艾达的故事已经完结了,它是一个完整的故事。

纪念碑谷游戏制作人 Adrienne Law 告诉 AppSo(微信号 AppSo),团队不想为了续作而去专门设计情节去承接实际上已经完整的故事,而且有大约 1/3 的新人加入团队,对故事充满了激情,有很多新想法,需要一个全新剧本去承载。

而 Dan Gray 也补充,希望通过开启一个新故事,让没有玩过纪念碑谷 1 的朋友,直接上手纪念碑谷 2 的时候,不会觉得错过了剧情。

但其实纪念碑谷 1 和 2 之间有很微妙的连通,只是藏得比较深,需要玩家仔细留意。

至于为什么选择了「亲子关系」这个主题,他们是这样看的:

很少有游戏触及母子关系的主题,纪念碑谷的玩家也会长大,我们自己也为人子女,在长大的过程中对母亲的想法会有所改变,所以会尝试探索这个话题。随着孩子不断成长,母亲和孩子的关系会不断地变化。

而我们在评测时也发现,这样的「探索」也反映在「双人关卡」的设计上。在部分关卡里,女儿会以母亲为「榜样」——我们控制罗尔移动,女儿也会进行相应的走位。需要两个人互相配合才能通关。

纪念碑谷的成功能复制吗?

像纪念碑谷这样现象级的独立游戏屈指可数,而能真正做到「叫好又叫座」的更是凤毛麟角。纪念碑谷的盈利模式很简单,就是单纯地买游戏,和国内靠卖装备卖金币真正赚钱的「氪金手游」不同。

这种单纯卖游戏的商业模式,同样适用于别的独立应用/游戏吗?

Dan Gray 给出了这样的回答:

看目标是什么。有很多小公司其实能一直以这样的方式做下去。如果保持公司现有的规模,则能维持经营。不过,一旦公司做大了,就不得不选择其他商业模式保持运营。

当然,纪念碑谷团队也会希望更多中国玩家接触这款游戏,同时让纪念碑谷这个 IP 有更多可能性的发展,他们选择了腾讯作为代理。

腾讯游戏是国内最大的移动游戏平台,而且有庞大的社区和用户群体。因此无论是用户量还是游戏 IP 的包装,我们可以期待纪念碑谷能有更多新的可能:

我们是个付费游戏,让更多的人知道我们,需要腾讯这样的公司来代理,扩大影响力。

无论选择什么代理公司,也不会影响它作为独立游戏的本质。初次开启时你可选择微信或 QQ 登录,这能让你分享图片到朋友圈等平台。当然你也可以选择游客模式,这不会对后续的关卡造成任何影响。

除此之外,纪念碑谷也会出自己的周边产品,让大家更立体地体验游戏世界。

目前,纪念碑谷 2 已上线各区 App Store,售价 30 元,而 Android 平台暂时未有上线计划。

因为大部分独立开发者都是开发付费游戏,而 iTunes 上付费 app 的推广效果最好。为了保持营收,所以大部分独立游戏都会先上 iOS 版本,或者干脆只有 iOS 版本。

不同人的选择不同,而 iOS 用户更倾向为高质量的游戏付费。除此之外,苹果也会提供更好的支持(纪念碑谷 2 已经横扫 App Store 推广位了),所以也是纪念碑谷团队选择 iOS 平台原因。

AppSo 当然知道,有很多愿意为优质 app 付费的 Android 用户,也有很多不愿意花钱的 iOS 用户,但平台给创作者的回馈不同,创作者自然会予以相应的选择。

这也是为什么 AppSo 一直倡导正版的原因:

你花的每一分钱,都在为你想要的世界买单。

Highlight.js

Build Status

Highlight.js is a syntax highlighter written in JavaScript. It works in
the browser as well as on the server. It works with pretty much any
markup, doesn’t depend on any framework and has automatic language
detection.

Getting Started

The bare minimum for using highlight.js on a web page is linking to the
library along with one of the styles and calling
initHighlightingOnLoad:

1
2
3
<link rel="stylesheet" href="/path/to/styles/default.css">
<script src="/path/to/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

This will find and highlight code inside of <pre><code> tags; it tries
to detect the language automatically. If automatic detection doesn’t
work for you, you can specify the language in the class attribute:

1
<pre><code class="html">...</code></pre>

The list of supported language classes is available in the class
reference
. Classes can also be prefixed with either language- or
lang-.

To disable highlighting altogether use the nohighlight class:

1
<pre><code class="nohighlight">...</code></pre>

Custom Initialization

When you need a bit more control over the initialization of
highlight.js, you can use the highlightBlock and configure
functions. This allows you to control what to highlight and when.

Here’s an equivalent way to calling initHighlightingOnLoad using
jQuery:

1
2
3
4
5
$(document).ready(function() {
$('pre code').each(function(i, block) {
hljs.highlightBlock(block);
});
});

You can use any tags instead of <pre><code> to mark up your code. If
you don’t use a container that preserve line breaks you will need to
configure highlight.js to use the <br> tag:

1
2
3
4
5
hljs.configure({useBR: true});

$('div.code').each(function(i, block) {
hljs.highlightBlock(block);
});

For other options refer to the documentation for configure.

Web Workers

You can run highlighting inside a web worker to avoid freezing the browser
window while dealing with very big chunks of code.

In your main script:

1
2
3
4
5
6
addEventListener('load', function() {
var code = document.querySelector('#code');
var worker = new Worker('worker.js');
worker.onmessage = function(event) { code.innerHTML = event.data; }
worker.postMessage(code.textContent);
})

In worker.js:

1
2
3
4
5
onmessage = function(event) {
importScripts('<path>/highlight.pack.js');
var result = self.hljs.highlightAuto(event.data);
postMessage(result.value);
}

Getting the Library

You can get highlight.js as a hosted, or custom-build, browser script or
as a server module. Right out of the box the browser script supports
both AMD and CommonJS, so if you wish you can use RequireJS or
Browserify without having to build from source. The server module also
works perfectly fine with Browserify, but there is the option to use a
build specific to browsers rather than something meant for a server.
Head over to the download page for all the options.

Don’t link to GitHub directly. The library is not supposed to work straight
from the source, it requires building. If none of the pre-packaged options
work for you refer to the building documentation.

The CDN-hosted package doesn’t have all the languages. Otherwise it’d be
too big. If you don’t see the language you need in the “Common” section,
it can be added manually:

1
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/languages/go.min.js"></script>

On Almond. You need to use the optimizer to give the module a name. For
example:

1
r.js -o name=hljs paths.hljs=/path/to/highlight out=highlight.js

License

Highlight.js is released under the BSD License. See LICENSE file
for details.

The official site for the library is at https://highlightjs.org/.

Further in-depth documentation for the API and other topics is at
http://highlightjs.readthedocs.io/.

Authors and contributors are listed in the AUTHORS.en.txt file.

css

1
2
3
4
div.icon{height:20px;width:20px;overflow: hidden;}
.icon .icon{width: 20px;height: 20px;display:block;position: relative;left: -20px;border-right: 20px solid transparent;
background: url(img/icon.png) no-repeat;-webkit-filter: drop-shadow(#000 20px 0);filter: drop-shadow(#000 20px 0);
}

html

1
2
3
4
<div class="icon">
<span class='icon' id='icon'></span>
</div>
<input type="color" id='color' />

JS

1
2
3
4
document.getElementById('color').onchange = function(){
var c = this.value;
document.getElementById('icon').style.webkitFilter = 'drop-shadow('+c+' 20px 0)';
}

在谷歌、火狐手机端、都是可以用的,使用的技术是 css 里滤镜里的投影。

我要睡到下一个世界大战

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<style type="text/css">
*{margin: 0px; padding: 0px;}
html,body{width: 100%; height: 100%;overflow: hidden;}

.section-wrap{width: 100%; height: 100%; overflow: visible;transition:transform 1s cubic-bezier(0.86,0,0.03,1);-webkit-transition:-webkit-transform 1s cubic-bezier(0.86,0,0.03,1);}
.section-wrap .section{width: 100%; height: 100%;}

.section-1{background: #0f0}
.section-2{background: #FF0}

.put-section-1{ transform:translateY(0);-webkit-transform:translateY(0);}
.put-section-2{ transform:translateY(-100%);-webkit-transform:translateY(-100%);}

.section-btn{ width:14px;position:fixed;right:4%;top:50%;}
.section-btn li{ width:14px;height:14px;cursor:pointer;text-indent:-9999px;border-radius:50%;-webkit-border-radius:50%;margin-bottom:12px; background:#BD362F;text-align:center; color:#fff; onsor:pointer;}
.section-btn li.on{ background:#fff}
</style>

<body>
<section class='section-wrap put-section-1'>
<div class="section section-1">
<div class='title'>
<p class="tit">111</p>
</div>
</div>
<div class="section section-2">
<div class='title'>
<p class="tit">222</p>
</div>
</div>
</section>
<ul class="section-btn">
<li class="on"></li>
<li></li>
</ul>

<script type="text/javascript" src='jiaoben3135/js/jquery.min.js'></script>
<script type="text/javascript">

$(function(){
var i=1;
var $btn = $('.section-btn li'),
$wrap = $('.section-wrap'),
$arrow = $('.arrow');

/*当前页面赋值*/
function up(){i++;if(i>$btn.length){i=1};}
function down(){i--;if(i<1){i=$btn.length};}

// /*页面滑动*/
function run(){
$btn.eq(i-1).addClass('on').siblings().removeClass('on');
$wrap.attr("class","section-wrap").addClass(function() { return "put-section-"+i; }).find('.section').eq(i).find('.title').addClass('active');
};

// /*右侧按钮点击*/
$btn.each(function(index) {
$(this).click(function(){
i=index+1;
run();
})
});

// /*翻页按钮点击*/
$arrow.one('click',go);
function go(){
up();run();
setTimeout(function(){$arrow.one('click',go)},1000)
};

// /*响应鼠标*/
$wrap.one('mousewheel',mouse_);
function mouse_(event){
if(event.deltaY<0) {up()}
else{down()}
run();
setTimeout(function(){$wrap.one('mousewheel',mouse_)},1000)
};

// /*响应键盘上下键*/
$(document).one('keydown',k);
function k(event){
var e=event||window.event;
var key=e.keyCode||e.which||e.charCode;
switch(key) {
case 38: down();run();
break;
case 40: up();run();
break;
};
setTimeout(function(){$(document).one('keydown',k)},1000);
}
});
</script>
</body>
</html>

配置:

1
2
'DB_TYPE' => 'sqlite',
'DB_NAME' => DATA_PATH.'/test.db',

文件:\Library\Think\Db\Driver\Sqlite.class.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
namespace Think\Db\Driver;

use Think\Db\Driver;

/**
* Sqlite数据库驱动
*/
class Sqlite extends Driver
{

/**
* 解析pdo连接的dsn信息
* @access public
* @param array $config 连接信息
* @return string
*/
protected function parseDsn($config)
{
$dsn = 'sqlite:' . $config['database'];
return $dsn;
}

/**
* 取得数据表的字段信息
* @access public
* @return array
*/
public function getFields($tableName)
{
list($tableName) = explode(' ', $tableName);
$result = $this->query('PRAGMA table_info( ' . $tableName . ' )');
$info = array();
if ($result) {
foreach ($result as $key => $val) {
$info[$val['name']] = array(
'name' => $val['name'],
'type' => $val['type'],
'notnull' => (bool) (1 === $val['notnull']),
'default' => $val['dflt_value'],
'primary' => '1' == $val['pk'],
'autoinc' => false,
);
}
}
return $info;
}

/**
* 取得数据库的表信息
* @access public
* @return array
*/
public function getTables($dbName = '')
{
$result = $this->query("SELECT name FROM sqlite_master WHERE type='table' "
. "UNION ALL SELECT name FROM sqlite_temp_master "
. "WHERE type='table' ORDER BY name");
$info = array();
foreach ($result as $key => $val) {
$info[$key] = current($val);
}
return $info;
}

/**
* SQL指令安全过滤
* @access public
* @param string $str SQL指令
* @return string
*/
public function escapeString($str)
{
return str_ireplace("'", "''", $str);
}

/**
* limit
* @access public
* @return string
*/
public function parseLimit($limit)
{
$limitStr = '';
if (!empty($limit)) {
$limit = explode(',', $limit);
if (count($limit) > 1) {
$limitStr .= ' LIMIT ' . $limit[1] . ' OFFSET ' . $limit[0] . ' ';
} else {
$limitStr .= ' LIMIT ' . $limit[0] . ' ';
}
}
return $limitStr;
}

/**
* 随机排序
* @access protected
* @return string
*/
protected function parseRand()
{
return 'RANDOM()';
}
}