如果您对iPhone使用小技巧感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于iPhone使用小技巧的详细内容,我们还将为您解答iphone使用小技巧的相关问题,并且为您提供
如果您对iPhone 使用小技巧感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于iPhone 使用小技巧的详细内容,我们还将为您解答iphone使用小技巧的相关问题,并且为您提供关于20个Python使用小技巧,建议收藏!、30个Python常用小技巧、Akka.net 性能测试兼使用小技巧、CakePHP 使用小技巧的有价值信息。
本文目录一览:iPhone 使用小技巧(iphone使用小技巧)
我的博客原文地址
- AssistiveTouch iOS5+
- 多任务 iOS8+
- 3D Touch iOS8+ iPhone6s+
1 AssistiveTouch开启关闭
1 设置 -> 通用 -> 辅助功能 -> AssistiveTouch -> 开启AssistiveTouch
2 通过屏幕浮动的AssistiveTouch小圆圈操作
2 3D Touch开启关闭
1 设置 -> 通用 -> 辅助功能 -> 3D Touch -> 开启3D Touch
2 通过用力按压屏幕操作
3 屏幕快照
方法一 快捷键
同时按手机的“电源键+主屏Home”键
方法二 通过AssistiveTouch
1 设置 -> 通用 -> 辅助功能 -> AssistiveTouch -> 开启AssistiveTouch
2 设置 -> 通用 -> 辅助功能 -> AssistiveTouch -> 自定顶层菜单 -> 添加“屏幕快照”
3 通过屏幕浮动的AssistiveTouch小圆圈操作
方法三 通过3D Touch 和 AssistiveTouch
1 设置 -> 通用 -> 辅助功能 -> 3D Touch -> 开启3D Touch
2 设置 -> 通用 -> 辅助功能 -> AssistiveTouch -> 开启AssistiveTouch
3 设置 -> 通用 -> 辅助功能 -> AssistiveTouch -> 自定顶层菜单 -> 3D Touch 操作 -> 设置成“屏幕快照”
4 通过用力按钮屏幕浮动的AssistiveTouch小圆圈即可获取屏幕快照
4 回到主屏
方法一 快捷键
单击“主屏Home”键
方法二 通过AssistiveTouch
1 设置 -> 通用 -> 辅助功能 -> AssistiveTouch -> 开启AssistiveTouch
2 设置 -> 通用 -> 辅助功能 -> AssistiveTouch -> 自定顶层菜单 -> 添加“主屏幕”
3 通过屏幕浮动的AssistiveTouch小圆圈操作
5 多任务
方法一 快捷键
连按两次“主屏Home”键
方法二 通过AssistiveTouch
1 设置 -> 通用 -> 辅助功能 -> AssistiveTouch -> 开启AssistiveTouch
2 设置 -> 通用 -> 辅助功能 -> AssistiveTouch -> 自定顶层菜单 -> 添加“多任务”
3 通过屏幕浮动的AssistiveTouch小圆圈操作
方法三 通过3D Touch
1 设置 -> 通用 -> 辅助功能 -> 3D Touch -> 开启3D Touch
2 在屏幕左侧边沿用力按,感觉到震动后向右滑动
方法四 AssistiveTouch
1 设置 -> 通用 -> 辅助功能 -> AssistiveTouch -> 开启AssistiveTouch
2 设置 -> 通用 -> 辅助功能 -> AssistiveTouch -> 自定顶层菜单 -> 设置为“主屏幕”(只能保留“主屏幕”,其他的全部删除)
3 通过连按两次屏幕浮动的AssistiveTouch小圆圈
6 屏幕永不关闭
设置 -> 通用 -> 自动锁定 -> 设置成“永不”
20个Python使用小技巧,建议收藏!
1、易混淆操作
本节对一些 Python 易混淆的操作进行对比。
1.1 有放回随机采样和无放回随机采样
import random random.choices(seq, k=1) # 长度为k的list,有放回采样 random.sample(seq, k) # 长度为k的list,无放回采样
1.2 lambda 函数的参数
func = lambda y: x + y # x的值在函数运行时被绑定 func = lambda y, x=x: x + y # x的值在函数定义时被绑定
1.3 copy 和 deepcopy
import copy y = copy.copy(x) # 只复制最顶层 y = copy.deepcopy(x) # 复制所有嵌套部分
复制和变量别名结合在一起时,容易混淆:
a = [1, 2, [3, 4]] # Alias. b_alias = a assert b_alias == a and b_alias is a # Shallow copy. b_shallow_copy = a[:] assert b_shallow_copy == a and b_shallow_copy is not a and b_shallow_copy[2] is a[2] # Deep copy. import copy b_deep_copy = copy.deepcopy(a) assert b_deep_copy == a and b_deep_copy is not a and b_deep_copy[2] is not a[2]
对别名的修改会影响原变量,(浅)复制中的元素是原列表中元素的别名,而深层复制是递归的进行复制,对深层复制的修改不影响原变量。
2、常用工具
2.1 读写 CSV 文件
import csv # 无header的读写 with open(name, 'rt', encoding='utf-8', newline='') as f: # newline=''让Python不将换行统一处理 for row in csv.reader(f): print(row[0], row[1]) # CSV读到的数据都是str类型 with open(name, mode='wt') as f: f_csv = csv.writer(f) f_csv.writerow(['symbol', 'change']) # 有header的读写 with open(name, mode='rt', newline='') as f: for row in csv.DictReader(f): print(row['symbol'], row['change']) with open(name, mode='wt') as f: header = ['symbol', 'change'] f_csv = csv.DictWriter(f, header) f_csv.writeheader() f_csv.writerow({'symbol': xx, 'change': xx})
注意,当 CSV 文件过大时会报错:_csv.Error: field larger than field limit (131072),通过修改上限解决
import sys csv.field_size_limit(sys.maxsize)
csv 还可以读以 \t 分割的数据
f = csv.reader(f, delimiter='\t')
2.2 迭代器工具
itertools 中定义了很多迭代器工具,例如子序列工具:
import itertools itertools.islice(iterable, start=None, stop, step=None) # islice('ABCDEF', 2, None) -> C, D, E, F itertools.filterfalse(predicate, iterable) # 过滤掉predicate为False的元素 # filterfalse(lambda x: x < 5, [1, 4, 6, 4, 1]) -> 6 itertools.takewhile(predicate, iterable) # 当predicate为False时停止迭代 # takewhile(lambda x: x < 5, [1, 4, 6, 4, 1]) -> 1, 4 itertools.dropwhile(predicate, iterable) # 当predicate为False时开始迭代 # dropwhile(lambda x: x < 5, [1, 4, 6, 4, 1]) -> 6, 4, 1 itertools.compress(iterable, selectors) # 根据selectors每个元素是True或False进行选择 # compress('ABCDEF', [1, 0, 1, 0, 1, 1]) -> A, C, E, F
序列排序:
sorted(iterable, key=None, reverse=False) itertools.groupby(iterable, key=None) # 按值分组,iterable需要先被排序 # groupby(sorted([1, 4, 6, 4, 1])) -> (1, iter1), (4, iter4), (6, iter6) itertools.permutations(iterable, r=None) # 排列,返回值是Tuple # permutations('ABCD', 2) -> AB, AC, AD, BA, BC, BD, CA, CB, CD, DA, DB, DC itertools.combinations(iterable, r=None) # 组合,返回值是Tuple itertools.combinations_with_replacement(...) # combinations('ABCD', 2) -> AB, AC, AD, BC, BD, CD
多个序列合并:
itertools.chain(*iterables) # 多个序列直接拼接 # chain('ABC', 'DEF') -> A, B, C, D, E, F import heapq heapq.merge(*iterables, key=None, reverse=False) # 多个序列按顺序拼接 # merge('ABF', 'CDE') -> A, B, C, D, E, F zip(*iterables) # 当最短的序列耗尽时停止,结果只能被消耗一次 itertools.zip_longest(*iterables, fillvalue=None) # 当最长的序列耗尽时停止,结果只能被消耗一次
2.3 计数器
计数器可以统计一个可迭代对象中每个元素出现的次数。
import collections # 创建 collections.Counter(iterable) # 频次 collections.Counter[key] # key出现频次 # 返回n个出现频次最高的元素和其对应出现频次,如果n为None,返回所有元素 collections.Counter.most_common(n=None) # 插入/更新 collections.Counter.update(iterable) counter1 + counter2; counter1 - counter2 # counter加减 # 检查两个字符串的组成元素是否相同 collections.Counter(list1) == collections.Counter(list2)
2.4 带默认值的 Dict
当访问不存在的 Key 时,defaultdict 会将其设置为某个默认值。
import collections collections.defaultdict(type) # 当第一次访问dict[key]时,会无参数调用type,给dict[key]提供一个初始值
2.5 有序 Dict
import collections collections.OrderedDict(items=None) # 迭代时保留原始插入顺序
3、高性能编程和调试
3.1 输出错误和警告信息
向标准错误输出信息
import sys sys.stderr.write('')
输出警告信息
import warnings warnings.warn(message, category=UserWarning) # category的取值有DeprecationWarning, SyntaxWarning, RuntimeWarning, ResourceWarning, FutureWarning
控制警告消息的输出
$ python -W all # 输出所有警告,等同于设置warnings.simplefilter('always') $ python -W ignore # 忽略所有警告,等同于设置warnings.simplefilter('ignore') $ python -W error # 将所有警告转换为异常,等同于设置warnings.simplefilter('error')
3.2 代码中测试
有时为了调试,我们想在代码中加一些代码,通常是一些 print 语句,可以写为:
# 在代码中的debug部分 if __debug__: pass
一旦调试结束,通过在命令行执行 -O 选项,会忽略这部分代码:
$ python -0 main.py
3.3 代码风格检查
使用 pylint 可以进行不少的代码风格和语法检查,能在运行之前发现一些错误
pylint main.py
3.4 代码耗时
耗时测试
$ python -m cProfile main.py
测试某代码块耗时
# 代码块耗时定义 from contextlib import contextmanager from time import perf_counter @contextmanager def timeblock(label): tic = perf_counter() try: yield finally: toc = perf_counter() print('%s : %s' % (label, toc - tic)) # 代码块耗时测试 with timeblock('counting'): pass
代码耗时优化的一些原则
以上就是20个Python使用小技巧,建议收藏!的详细内容,更多请关注php中文网其它相关文章!
30个Python常用小技巧
转自:http://www.weidianyuedu.com/content/1411889871015.html
1、原地交换两个数字
x, y =10, 20
print(x, y)
y, x = x, y
print(x, y)
10 20
20 10
2、链状比较操作符
n = 10
print(1 < n < 20)
print(1 > n <= 9)
True
False
3、使用三元操作符来实现条件赋值
[表达式为真的返回值] if [表达式] else [表达式为假的返回值]
y = 20
x = 9 if (y == 10) else 8
print(x)
8
找abc中最小的数
def small(a, b, c):
return a if a<b and a<c else (b if b<a and b<c else c)
print(small(1, 0, 1))
print(small(1, 2, 2))
print(small(2, 2, 3))
print(small(5, 4, 3))
0
1
3
3
列表推导
x = [m2 if m>10 else m4 for m in range(50)]
print(x)
[0, 1, 16, 81, 256, 625, 1296, 2401, 4096, 6561, 10000, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1024, 1089, 1156, 1225, 1296, 1369, 1444, 1521, 1600, 1681, 1764, 1849, 1936, 2025, 2116, 2209, 2304, 2401]
4、多行字符串
multistr = “select * from multi_row
where row_id < 5”
print(multistr)
select * from multi_row where row_id < 5
multistr = “”“select * from multi_row
where row_id < 5"”"
print(multistr)
select * from multi_row
where row_id < 5
multistr = (“select * from multi_row”
“where row_id < 5”
“order by age”)
print(multistr)
select * from multi_rowwhere row_id < 5order by age
5、存储列表元素到新的变量
testList = [1, 2, 3]
x, y, z = testList # 变量个数应该和列表长度严格一致
print(x, y, z)
1 2 3
6、打印引入模块的绝对路径
import threading
import socket
print(threading)
print(socket)
<module ‘threading’ from ‘d:\python351\lib\threading.py’>
<module ‘socket’ from ‘d:\python351\lib\socket.py’>
7、交互环境下的“_”操作符
在python控制台,不论我们测试一个表达式还是调用一个方法,结果都会分配给一个临时变量“_”
8、字典/集合推导
testDic = {i: i * i for i in range(10)}
testSet = {i * 2 for i in range(10)}
print(testDic)
print(testSet)
{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64, 9: 81}
{0, 2, 4, 6, 8, 10, 12, 14, 16, 18}
9、调试脚本
用pdb模块设置断点
import pdb
pdb.ste_trace()
10、开启文件分享
python允许开启一个HTTP服务器从根目录共享文件
python -m http.server
11、检查python中的对象
test = [1, 3, 5, 7]
print(dir(test))
[‘add’, ‘class’, ‘contains’, ‘delattr’, ‘delitem’, ‘dir’, ‘doc’, ‘eq’, ‘format’, ‘ge’, ‘getattribute’, ‘getitem’, ‘gt’, ‘hash’, ‘iadd’, ‘imul’, ‘init’, ‘iter’, ‘le’, ‘len’, ‘lt’, ‘mul’, ‘ne’, ‘new’, ‘reduce’, ‘reduce_ex’, ‘repr’, ‘reversed’, ‘rmul’, ‘setattr’, ‘setitem’, ‘sizeof’, ‘str’, ‘subclasshook’, ‘append’, ‘clear’, ‘copy’, ‘count’, ‘extend’, ‘index’, ‘insert’, ‘pop’, ‘remove’, ‘reverse’, ‘sort’]
test = range(10)
print(dir(test))
[‘class’, ‘contains’, ‘delattr’, ‘dir’, ‘doc’, ‘eq’, ‘format’, ‘ge’, ‘getattribute’, ‘getitem’, ‘gt’, ‘hash’, ‘init’, ‘iter’, ‘le’, ‘len’, ‘lt’, ‘ne’, ‘new’, ‘reduce’, ‘reduce_ex’, ‘repr’, ‘reversed’, ‘setattr’, ‘sizeof’, ‘str’, ‘subclasshook’, ‘count’, ‘index’, ‘start’, ‘step’, ‘stop’]
12、简化if语句
use following way to verify multi values
if m in [1, 2, 3, 4]:
do not use following way
if m1 or m2 or m3 or m4:
13、运行时检测python版本
import sys
if not hasattr(sys, “hexversion”) or sys.version_info != (2, 7):
print(“sorry, you are not running on python 2.7”)
print(“current python version:”, sys.version)
sorry, you are not running on python 2.7
current python version: 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)]
14、组合多个字符串
test = [“I”, “Like”, “Python”]
print(test)
print("".join(test))
[‘I’, ‘Like’, ‘Python’]
ILikePython
15、四种翻转字符串、列表的方式
5
3
1
16、用枚举在循环中找到索引
test = [10, 20, 30]
for i, value in enumerate(test):
print(i, ‘:’, value)
0 : 10
1 : 20
2 : 30
17、定义枚举量
class shapes:
circle, square, triangle, quadrangle = range(4)
print(shapes.circle)
print(shapes.square)
print(shapes.triangle)
print(shapes.quadrangle)
0
1
2
3
18、从方法中返回多个值
def x():
return 1, 2, 3, 4
a, b, c, d = x()
print(a, b, c, d)
1 2 3 4
19、使用*运算符unpack函数参数
def test(x, y, z):
print(x, y, z)
testDic = {‘x’:1, ‘y’:2, ‘z’:3}
testList = [10, 20, 30]
test(*testDic)
test(**testDic)
test(*testList)
z x y
1 2 3
10 20 30
20、用字典来存储表达式
stdcalc = {
“sum”: lambda x, y: x + y,
“subtract”: lambda x, y: x - y
}
print(stdcalc[“sum”](9, 3))
print(stdcalc[“subtract”](9, 3))
12
6
21、计算任何数的阶乘
import functools
result = (lambda k: functools.reduce(int.mul, range(1, k+1), 1))(3)
print(result)
6
22、找到列表中出现次数最多的数
test = [1, 2, 3, 4, 2, 2, 3, 1, 4, 4, 4, 4]
print(max(set(test), key=test.count))
4
23、重置递归限制
python限制递归次数到1000,可以用下面方法重置
import sys
x = 1200
print(sys.getrecursionlimit())
sys.setrecursionlimit(x)
print(sys.getrecursionlimit())
1000
1200
24、检查一个对象的内存使用
import sys
x = 1
print(sys.getsizeof(x)) # python3.5中一个32比特的整数占用28字节
28
25、使用slots减少内存开支
import sys
原始类
class FileSystem(object):
def init(self, files, folders, devices):
self.files = files
self.folder = folders
self.devices = devices
print(sys.getsizeof(FileSystem))
减少内存后
class FileSystem(object):
slots = [‘files’, ‘folders’, ‘devices’]
def init(self, files, folders, devices):
self.files = files
self.folder = folders
self.devices = devices
print(sys.getsizeof(FileSystem))
1016
888
26、用lambda 来模仿输出方法
import sys
lprint = lambda *args: sys.stdout.write(" ".join(map(str, args)))
lprint(“python”, “tips”, 1000, 1001)
python tips 1000 1001
27、从两个相关序列构建一个字典
t1 = (1, 2, 3)
t2 = (10, 20, 30)
print(dict(zip(t1, t2)))
{1: 10, 2: 20, 3: 30}
28、搜索字符串的多个前后缀
print(“http://localhost:8888/notebooks/Untitled6.ipynb”.startswith((“http://”, “https://”)))
print(“http://localhost:8888/notebooks/Untitled6.ipynb”.endswith((".ipynb", “.py”)))
True
True
29、不使用循环构造一个列表
import itertools
import numpy as np
test = [[-1, -2], [30, 40], [25, 35]]
print(list(itertools.chain.from_iterable(test)))
[-1, -2, 30, 40, 25, 35]
30、实现switch-case语句
def xswitch(x):
return xswitch._system_dict.get(x, None)
xswitch._system_dict = {“files”:10, “folders”:5, “devices”:2}
print(xswitch(“default”))
print(xswitch(“devices”))
None
Akka.net 性能测试兼使用小技巧
最近想研究一下分布式开发,先拿了 akka.net 跑一下性能
参考自己写个网络实现,一般在本机通讯,300M 每秒的传输率,作为参考
嗯,先说结果,用 Akka.net 直接发 bytearray,最后也只有 40M 每秒的传输率。
所以高性能场合不适用。
另外 akka.net remote 有个小小的问题
Akka.net 的 服务一侧配置如下
remote {
dot-netty.tcp {
port = 8090
hostname = 0.0.0.0
}
}
此时纵有千般武艺你也不可能连的进来
因为
Akka.net 有一个类似 http 的跨域设计,你客户端请求地址如下
"akka.tcp://server@10.1.1.176:8090/user/Echo";
你不可能用 0.0.0.0 做请求地址吧。
就算 从服务一侧 指定 public_hostname 还是有一个问题
一个服务器只能对应一个域名
这在调试时非常不便,我有一个服务。
我就想
"akka.tcp://server@127.0.0.1:8090/user/Echo";
"akka.tcp://server@localhost:8090/user/Echo";
"akka.tcp://server@10.1.1.176:8090/user/Echo";
这三种方式都能访问
现在的 akka 是做不到的,除非你用我这个办法
static void AddAkkaRemoteHost(ActorSystem system, string[] morehost = null)
{
var ext = system as ExtendedActorSystem;
IRemoteActorRefProvider provider = ext.Provider as IRemoteActorRefProvider;
var addrs = provider.Transport.Addresses;
var addrslist = addrs.GetEnumerator();
addrslist.MoveNext();
Address first = addrslist.Current;
if (first.Host != "localhost")
addrs.Add(new Address(first.Protocol, first.System, "localhost", first.Port));
if (first.Host != "127.0.0.1")
addrs.Add(new Address(first.Protocol, first.System, "127.0.0.1", first.Port));
if (morehost != null)
{
foreach (var host in morehost)
{
if (first.Host != host)
addrs.Add(new Address(first.Protocol, first.System, host, first.Port));
}
}
}
using (var system = ActorSystem.Create("server", config))
{
AddAkkaRemoteHost(system, new string[] { "10.1.1.176" });
system.ActorOf(
Props.Create(
() => new ChatServerActor()
)
, "Echo"
);
Console.ReadKey();
}
你能从这里获取代码
https://github.com/lightszero/akka.learn
CakePHP 使用小技巧
知道主键 ID 更新一条数据,代码示例:
php
$this->Order->id = $id; $this->Order->saveField(''status'', $status);
点赞的时候需要+1,如何更新数据库?
php
$this->Widget->updateAll( array(''Widget.numberfield'' => ''Widget.numberfield + 1''), array(''Widget.id'' => 1) );
如何通过主键最简单的方式获取到一条数据?
php
// 只获取name字段信息 $this->User->read(''name'', $id); // 获取所有信息 $this->User->read(null, $id);
CakePHP控制器如何返回上一页?
php
$this->redirect($this->referer());
CakePHP A控制器调用B控制器?
php
$this->requestAction( array(''controller''=>''Wx'',''action''=>''aa''), array(''data''=> array(''xing''=>''A1'',''ming''=>''A2'') ) );
这样可以在A控制器调用B控制器方法,而且在后面传参过去,用$this->request->data获取参数值。
输出单个页面执行的 SQL 语句
php
$log = $this->Model->getDataSource()->getLog(false, false); debug($log);
Model要改一下名字才能用。
模糊和 OR 搜索示例:
php
$this->User->find(''all'', array( ''conditions'' => array( ''OR'' =>array( array(''nickname like '' => "%$keyword%"), array(''User.id'' => $keyword), ) ), ''fields'' => ''User.id,User.nickname'' ));
find 的 语法糖
php
#findAllBy<fieldName>(string $value, array $fields, array $order, int $limit, int $page, int $recursive) $this->Product->findAllByOrderStatus(''3''); $this->User->findAllByUsernameAndPassword(''jhon'', ''123''); $this->User->findAllByEmailOrUsername(''jhon'', ''jhon''); $this->User->findAllByLastName(''psychic'', array(),array(''User.user_name'' => ''asc'')); #findBy<fieldName>(string $value[, mixed $fields[, mixed $order]]); $this->Recipe->findByType(''Cookie''); $this->User->findByEmailOrUsername(''jhon'',''jhon''); $this->User->findByUsernameAndPassword(''jhon'',''123'');
CakePHP saveAll 的用法:
php
for ($i=0; $i < count($data[''product_id'']); $i++) { $item[$i][''DiscountProduct''][''discount_id''] = $this->Discount->id; $item[$i][''DiscountProduct''][''discount''] = $data[''discount''][$i]; } $this->DiscountProduct->saveAll($item);
如果要是有 CakePHP 自带和 HTML 结合的 FORM
必须在 Controller 的 action 里面使用这个:$this->request->data = $data;
修改的时候才能读取数据,并且view里面的 form 要使用 CakePHP 的
php
<?php echo $this->Form->create(''PrintAd'', array(''type''=>''post'')); ?>
CakePHP 中表有以下字段名,则自动更新时间
sql
`created` datetime NOT NULL, `modified` datetime NOT NULL,
CakePHP 自带图片+链接
php
echo $this->Html->link( $this->Html->image($value[''PrintClient''][''weixin_code_img''], array(''width''=>''60px'')), $value[''PrintClient''][''weixin_code_img''], array(''escape'' => false) );
CakePHP 查询的时候表联接
php
$options[''joins''] = array( array( ''table'' => ''channels'', ''alias'' => ''Channel'', ''type'' => ''LEFT'', ''conditions'' => array( ''Channel.id = Item.channel_id'', ) )); $Item->find(''all'', $options);
CakePHP 获取当前域名
php
Router::fullbaseUrl()
CakePHP 控制器构造函数的用法:
php
public function__construct($request = null, $response = null) { parent::__construct($request, $response); # code... }
CakePHP 视图获取 URL 的参数值
php
#array(): $this->params->pass #第一个值: $this->params->pass[0]
CakePHP 联表分页
php
$this->loadModel(''WifiList''); $this->SearchPagination->setup(''WifiList''); $this->request->data[''WifiList''][''seller_id''] = SELLER_ID; $this->paginate = array( ''fields'' => array(''WifiList.*'', ''WxPersistentQrcodes.ticket''), ''conditions'' => $this->WifiList->parseCriteria($this->request->data[''WifiList'']), ''order'' => ''WifiList.id desc'', ''joins'' => array( array( ''table''=>''wx_persistent_qrcodes'', ''alias''=>''WxPersistentQrcodes'', ''type''=>''LEFT'', ''conditions''=>array( ''WifiList.wx_p_qrcode_id=WxPersistentQrcodes.scene_id and WxPersistentQrcodes.seller_id=''.SELLER_ID ) ) ), ''limit'' => 10 ); $data = $this->paginate(''WifiList''); $this->set(compact(''data''));
CakePHP 抛出异常
php
if(!$id){ throw new NotFoundException(); }
CakePHP 跳转链接
php
$this->redirect(array( ''controller''=>''dist'', ''action''=>''result'', $status, ''?''=>array(''sid''=>SELLER_ID,) ));
CakePHP Model 使用其他模型
php
// the other model to load & use App::uses(''AnotherModel'', ''Model''); class MyModel extends AppModel { public $name = ''MyModel''; public function test() { // load the Model $anotherModel = new AnotherModel(); // use the Model $anotherModel->save($data); } }
关于iPhone 使用小技巧和iphone使用小技巧的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于20个Python使用小技巧,建议收藏!、30个Python常用小技巧、Akka.net 性能测试兼使用小技巧、CakePHP 使用小技巧的相关信息,请在本站寻找。
本文标签: