🚙

💨 💨 💨

×

  • Categories

  • Archives

  • Tags

  • About

PHP的超级全局变量小结

Posted on 07-13-2015 | In Misc

PHP 超级全局变量概绍

PHP中预定义了几个超级全局变量(superglobals) ,

这意味着它们在一个脚本的全部作用域中都可用。

你不需要特别说明,就可以在函数及类中使用。

PHP 超级全局变量列表:

  • $GLOBALS
  • $_SERVER
  • $_REQUEST
  • $_POST
  • $_GET
  • $_FILES
  • $_ENV
  • $_COOKIE
  • $_SESSION

$GLOBALS

$GLOBALS 是PHP的一个超级全局变量组,

在一个PHP脚本的全部作用域中都可以访问。

$GLOBALS 是一个包含了全部变量的全局组合数组。变量的名字就是数组的键。

以下实例介绍了如何使用超级全局变量 $GLOBALS:

<?php 
$x = 75;
$y = 25;

function addition()
{
$GLOBALS['z'] = $GLOBALS['x'] + $GLOBALS['y'];
}

addition();
echo $z;
?>

以上实例中 z 是一个$GLOBALS数组中的超级全局变量,
该变量同样可以在函数外访问。

$_SERVER

$_SERVER 是一个包含了诸如头信息(header)、路径(path)、以及脚本位置(script locations)等等信息的数组。

这个数组中的项目由 Web 服务器创建。

不能保证每个服务器都提供全部项目;服务器可能会忽略一些,或

者提供一些没有在这里列举出来的项目。

以下实例中展示了如何使用$_SERVER中的元素:

<?php 
echo $_SERVER['PHP_SELF'];
echo "<br>";
echo $_SERVER['SERVER_NAME'];
echo "<br>";
echo $_SERVER['HTTP_HOST'];
echo "<br>";
echo $_SERVER['HTTP_REFERER'];
echo "<br>";
echo $_SERVER['HTTP_USER_AGENT'];
echo "<br>";
echo $_SERVER['SCRIPT_NAME'];
?>

$_REQUEST

PHP $_REQUEST 用于收集HTML表单提交的数据。

以下实例显示了一个输入字段(input)及提交按钮(submit)的表单(form)。

当用户通过点击 “Submit” 按钮提交表单数据时,

表单数据将发送至

标签中 action 属性中指定的脚本文件。

在这个实例中,我们指定文件来处理表单数据。

如果你希望其他的PHP文件来处理该数据,你可以修改该指定的脚本文件名。

然后,我们可以使用超级全局变量 $_REQUEST 来收集表单中的 input 字段数据:

 <html>
<body>

<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
Name: <input type="text" name="fname">
<input type="submit">
</form>

<?php
$name = $_REQUEST['fname'];
echo $name;
?>

</body>
</html>

$_POST

PHP $_POST 被广泛应用于收集表单数据,

在HTML form标签的指定该属性:”method=”post”。

以下实例显示了一个输入字段(input)及提交按钮(submit)的表单(form)。

当用户通过点击 “Submit” 按钮提交表单数据时,

表单数据将发送至

标签中 action 属性中指定的脚本文件。

在这个实例中,我们指定文件来处理表单数据。

如果你希望其他的PHP文件来处理该数据,你可以修改该指定的脚本文件名。

然后,我们可以使用超级全局变量 $_POST 来收集表单中的 input 字段数据:

<html>
<body>

<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
Name: <input type="text" name="fname">
<input type="submit">
</form>

<?php
$name = $_POST['fname'];
echo $name;
?>

</body>
</html>

$_GET

PHP $_GET 同样被广泛应用于收集表单数据,

在HTML form标签的指定该属性:”method=”get”。

$_GET 也可以收集URL中发送的数据。

假定我们有一个包含参数的超链接HTML页面:

<html>
<body>

<a href="test_get.php?subject=PHP&web=runoob.com">Test $GET</a>

</body>
</html>

当用户点击链接 “Test $GET”, 参数 “subject” 和 “web” 将发送至”test_get.php”,

你可以在 “test_get.php” 文件中使用 $_GET 变量来获取这些数据。

以下实例显示了 “test_get.php” 文件的代码:

<html>
<body>

<?php
echo "Study " . $_GET['subject'] . " at " . $_GET['web'];
?>

</body>
</html>

$_REQUEST、$_POST、$_GET的区别和联系小结

1. $_REQUEST

php中$_REQUEST可以获取以POST方法和GET方法提交的数据,但是速度比较慢

2. $_GET

用来获取由浏览器通过GET方法提交的数据。GET方法他是通过把参数数据加在提交表单的action属性所指的URL中,值和表单内每个字段一一对应,然后在URL中可以看到,但是有如下缺点:

    1. 安全性不好,在URL中可以看得到
    1. 传送数据量较小,不能大于2KB。

3. $_POST

用来获取由浏览器通过POST方法提交的数据。POST方法他是通过HTTP POST机制,将表单的各个字段放置在HTTP HEADER内一起传送到action属性所指的URL地址中,用户看不到这个过程。他提交的大小一般来说不受限制,但是具体根据服务器的不同,还是略有不同。相对于_GET方式安全性略高

4. $_REQUEST、$_POST、$_GET 的区别和联系

$_REQUEST[“参数”]具用$_POST[“参数”] $_GET[“参数”]的功能,但是$_REQUEST[“参数”]比较慢。通过post和get方法提交的所有数据都可以通过$_REQUEST数组[“参数”]获得

python和lua数据类型的比较

Posted on 07-11-2015 | In Misc

Python比较特殊的数据类型:

List []

例如 :

#!/usr/bin/python
# -*- coding: UTF-8 -*-

list = [ 'runoob', 786 , 2.23, 'john', 70.2 ]
tinylist = [123, 'john']

print list # 输出完整列表
print list[0] # 输出列表的第一个元素
print list[1:3] # 输出第二个至第三个的元素
print list[2:] # 输出从第三个开始至列表末尾的所有元素
print tinylist * 2 # 输出列表两次
print list + tinylist # 打印组合的列表

以上实例输出结果:

['runoob', 786, 2.23, 'john', 70.2]
runoob
[786, 2.23]
[2.23, 'john', 70.2]
[123, 'john', 123, 'john']
['runoob', 786, 2.23, 'john', 70.2, 123, 'john']

Tuple(元祖)(),相当于只读列表,不可以二次赋值

tuple = ( 'runoob', 786 , 2.23, 'john', 70.2 ), 除了元祖用()而list用[], 而且元祖只是可读的, 其他的跟list一毛一样

dictionary(字典){},key值对

#!/usr/bin/python
# -*- coding: UTF-8 -*-

dict = {}
dict['one'] = "This is one"
dict[2] = "This is two"

tinydict = {'name': 'john','code':6734, 'dept': 'sales'}


print dict['one'] # 输出键为'one' 的值
print dict[2] # 输出键为 2 的值
print tinydict # 输出完整的字典
print tinydict.keys() # 输出所有键
print tinydict.values() # 输出所有值

输出结果为:

This is one
This is two
{'dept': 'sales', 'code': 6734, 'name': 'john'}
['dept', 'code', 'name']
['sales', 6734, 'john']

lua比较特殊的数据类型

lua变量

变量在使用前,必须在代码中进行声明,即创建该变量。

编译程序执行代码之前编译器需要知道如何给语句变量开辟存储区,用于存储变量的值。

Lua 变量有三种类型:全局变量、局部变量、表中的域。

Lua 中的变量全是全局变量,那怕是语句块或是函数里,除非用 local 显式声明为局部变量。

局部变量的作用域为从声明位置开始到所在语句块结束。

变量的默认值均为 nil。

test.lua 文件脚本
a = 5               -- 全局变量
local b = 5 -- 局部变量

function joke()
c = 5 -- 全局变量
local d = 6 -- 局部变量
end

joke()
print(c,d) --> 5 nil

do
local a = 6 -- 局部变量
b = 6 -- 全局变量
print(a,b); --> 6 6
end

print(a,b) --> 5 6

执行以上实例输出结果为:

$ lua test.lua 
5 nil
6 6
5 6

lua的特有的东西table(表)

在 Lua 里,table 的创建是通过”构造表达式”来完成,

最简单构造表达式是{},用来创建一个空表。

也可以在表里添加一些数据,直接初始化表:

-- 创建一个空的 table
local tbl1 = {}

-- 直接初始表
local tbl2 = {"apple", "pear", "orange", "grape"}

Lua 中的表(table)其实是一个”关联数组”(associative arrays),数组的索引可以是数字或者是字符串。

-- table_test.lua 脚本文件
a = {}
a["key"] = "value"
key = 10
a[key] = 22
a[key] = a[key] + 11
for k, v in pairs(a) do
print(k .. " : " .. v)
end

脚本执行结果为:

$ lua table_test.lua 
key : value
10 : 33

不同于其他语言的数组把 0 作为数组的初始索引,在 Lua 里表的默认初始索引一般以 1 开始。

-- table_test2.lua 脚本文件
local tbl = {"apple", "pear", "orange", "grape"}
for key, val in pairs(tbl) do
print("Key", key)
end

脚本执行结果为:

$ lua table_test2.lua 
Key 1
Key 2
Key 3
Key 4

table 不会固定长度大小,有新数据添加时 table 长度会自动增长,没初始的 table 都是 nil。

-- table_test3.lua 脚本文件
a3 = {}
for i = 1, 10 do
a3[i] = i
end
a3["key"] = "val"
print(a3["key"])
print(a3["none"])

脚本执行结果为:

$ lua table_test3.lua 
val
nil

redis概要之数据类型

Posted on 07-11-2015 | In DB

Redis简介要义

  • Redis运行在内存中但是可以持久化到磁盘, 重启的时候可以再次加载进行使用

  • Redis的所有操作都是原子性的,同时Redis还支持对几个操作全并后的原子性执行

  • Redis支持二进制案例的 Strings, Lists, Hashes, Sets 及 Ordered Sets 数据类型操作

  • Redis支持数据的备份,即master-slave模式的数据备份

Redis数据类型

Redis的数据类型很重要, 这是他做很多事情的基础, 不理解的话很难用好

. . .

redis和hiredis安装教程

Posted on 07-11-2015 | In DB

在ubuntu上

redis安装 : sudo apt-get install redis-server

hiredis安装 : 先到 https://github.com/redis/hiredis 下载 hiredis , 然后

sudo make
sudo make install
sudo ldconfig

socket可读可写条件与非阻塞connect或accept浅析

Posted on 06-22-2015 | In NP

socket可读的条件:

  • socket的接收缓冲区中的数据字节大于等于该socket的接收缓冲区低水位标记的当前大小。对这样的socket的读操作将不阻塞并返回一个大于0的值(也就是返回准备好读入的数据)。我们可以用SO_RCVLOWAT这个socket选项来设置该socket的低水位标记。对于TCP和UDP的socket而言,其缺省值为1.
  • 该连接的读这一半关闭(也就是接收了FIN的TCP连接)。对这样的socket的读操作将不阻塞并返回0
  • 给监听套接字准备好新连接
  • 有一个socket有异常错误条件待处理.对于这样的socket的读操作将不会阻塞,并且返回一个错误(-1),errno则设置成明确的错误条件.这些待处理的错误也可通过指定socket选项SO_ERROR调用getsockopt来取得并清除;

. . .

epoll扼要总结

Posted on 06-22-2015 | In Linux

epoll 编程接口

epoll API是Linux系统专有的,在2.6版中新增。

epoll API的核心数据结构称作epoll实例,它和一个打开的文件描述符相关联。这个文件
描述符不是用来做I/O操作的,相反,它是内核数据结构的句柄,这些内核数据结构实现了两
个目的。

  • 记录了在进程中声明过的感兴趣的文件描述符列表-interest list(兴趣列表)。
  • 维护了处于I/O就绪态的文件描述符列表-ready list(就绪列表)。

ready list中的成员是interest list的子集。

对于由epoll检查的每一个文件描述符,我们可以指定一个位掩码来表示我们感兴趣的事
件。这些位掩码同poll()所使用的位掩码有着紧密的关联。

. . .

Top 500 English sentences for daily life

Posted on 06-21-2015 | In English

问候与寒暄

  1. How are you doing? 你最近怎么样?
  2. I’m so glad to meet you. 我很高兴见到你。
  3. How are you doing today? 你今天过得咋样?
  4. How’s it going? 最近过得怎么样?

提供与寻求帮助

  1. How can I help you? 我能帮你什么吗?(接到陌生电话第一句可以说这个)
  2. Could you help me, please? 你能帮我一下吗?
  3. Could you help me with this? 你能帮我一下这个吗?
  4. Do you need any help? 你需要帮助吗?
  5. Can I help you? 我能帮你吗?
  6. Is there anything I can do for you? 我能为你做点什么吗?

表达观点与回应

  1. What do you think? 你觉得怎么样?
  2. What do you think about it? 你咋看这件事?
  3. I totally agree with you. 我完全同意你。
  4. I couldn’t agree more. 我完全同意。
  5. I don’t think so. 我不这么认为。
  6. That’s exactly what I was thinking. 这正是我所想的。
  7. You’ve got a point. 你说得有道理。
  8. It doesn’t make sense. 这说不通。
  9. Does it make sense? 这个说得通有道理吗?
  10. I’m not sure about that. 我不太确定。
  11. I have no idea. 我完全不知道。
  12. I’m not in the mood. 我没心情。
  13. That sounds great. 听起来很棒。
  14. It’s not a big deal. 这没什么大不了的。
  15. It’s not my cup of tea. 那不是我的兴趣所在。
  16. It’s none of your business. 这不关你的事。
  17. Don’t take it personally. 别往心里去。
  18. Don’t take it seriously. 别太当真。
  19. Better late than never. 迟到总比不到好。

请求重复、解释与放慢语速

  1. Could you repeat that, please? 你能再重复一遍吗?
  2. Could you please repeat that? 你可以再说一遍吗?
  3. Could you please repeat that more slowly? 你能再慢点重复一遍吗?
  4. Sorry, I didn’t catch that. 抱歉,我没听清。
  5. I’m sorry, I didn’t catch your name. 很抱歉,我没听清你的名字。
  6. I’m afraid I don’t understand. 恐怕我不明白。
  7. Could you explain that to me? 你能跟我解释一下吗?
  8. Could you speak a bit slower, please? 你可以说慢一点吗?
  9. Could you speak more slowly? 你能说得慢一点吗?
  10. Could you speak a little slower? 你能说慢得一点吗?

询问个人信息

  1. Where are you from? 你来自哪里?
  2. What do you do in your free time? 你空闲时间做什么?
  3. Do you speak English? 你会说英语吗? (不说 can u speak eng)
  4. What’s your favorite food? 你最喜欢的食物是什么?
  5. What’s your favorite movie? 你最喜欢的电影是什么?
  6. Do you have any hobbies? 你有什么爱好吗?
  7. How long have you been living here? 你在这里住了多久了?
  8. What’s your favorite type of music? 你最喜欢哪种类型的音乐?
  9. Do you have any dietary restrictions? 你有什么饮食限制吗?

问路与询问地点相关信息

  1. Excuse me, where is the restroom? 请问洗手间在哪里?
  2. Could you tell me where the restroom is? 你能告诉我卫生间在哪里吗?
  3. Can you tell me where the nearest station is? 你能告诉我最近的车站在哪里吗?
  4. Could you tell me the way to the airport? 你能告诉我去机场的路吗?
  5. How do I get to the airport? 我怎么去机场?
  6. How do I get to the train station? 我怎么去火车站?
  7. How do I get to the main square? 怎么去主广场?
  8. How can I get to the nearest subway station? 最近的地铁站怎么走?
  9. Where is the nearest ATM? 最近的取款机在哪里?
  10. Where is the nearest train station? 最近的火车站在哪里?
  11. Where is the nearest subway station? 最近的地铁站在哪里?
  12. Is there a hospital nearby? 附近有医院吗?
  13. Is there a supermarket nearby? 这里附近有超市吗?
  14. Is there a place to park nearby? 附近有停车的地方吗?
  15. Is there a place to exchange money nearby? 附近有兑换货币的地方吗?
  16. Are there any beaches nearby? 附近有沙滩吗?
  17. Are there any vegetarian restaurants around? 附近有素食餐厅吗?
  18. Is there a good place for hiking nearby? 附近有适合徒步的地方吗?
  19. Is there a good place for shopping? 你知道购物的好地方吗?
  20. Where can I find a pharmacy? 你知道哪里可以找到药店吗?
  21. Where can I find a good coffee shop? 哪里可以找到不错的咖啡馆?
  22. Where can I find a public restroom? 哪里有公共厕所?
  23. Where can I rent a car? 哪里可以租车?
  24. Where can I buy a SIM card for my phone? 哪里可以买到手机的SIM卡?
  25. I’m looking for a coffee shop. 我在找一家咖啡店。
  26. I’m lost. 我迷路了。
  27. I’m trying to find… 我在试图找…… (可根据情境补充具体地点)

时间相关询问

  1. What time is it now? 现在几点了?
  2. What time is it? 现在几点?
  3. What time does the meeting start? 会议几点开始?
  4. What time does the store close? 这家店几点关门?
  5. What time do we need to leave? 我们需要几点离开?
  6. What time do you usually have dinner? 你通常什么时候吃晚饭?
  7. What time is check - out? 退房时间是几点?
  8. What time does the last bus leave? 最后一班公交车几点发车?
  9. How long will it take? 需要多久?
  10. How long will it take to get there? 到那里需要多长时间?

购物、餐饮与消费相关

  1. How much is this? 这个多少钱?
  2. How much does it cost? 这个多少钱?
  3. How much does it cost for one night? 一晚多少钱?
  4. How much does it cost to get in? 入场费是多少?
  5. Could I get the bill, please? 我可以结账了吗?
  6. Can I have the check, please? 可以请给我账单吗?
  7. I’d like to have this, please. 我想要这个。
  8. I’d like a table for two, please. 我想要一张两人桌,谢谢。
  9. I’d like to book a table for two. 我想订一个两个人的桌子。
  10. I’d like to book a room for two nights. 我想订一个房间住两晚。
  11. Do you take credit cards? 你们接受信用卡吗?
  12. Do you accept credit cards here? 这里接受信用卡吗?
  13. Can I pay in cash? 我可以用现金支付吗?
  14. Can I pay by credit card? 我可以刷卡吗?
  15. Can I pay in installments? 我可以分期付款吗?
  16. Do you have any special discounts? 你们有特别折扣吗?
  17. Is it possible to get a discount? 可以打折吗?
  18. What would you like to drink? 你想喝点啥?
  19. Can I have a cup of coffee, please? 我可以来杯咖啡吗?
  20. Can I have a glass of water, please? 请给我一杯水好吗?
  21. Do you have any vegetarian options? 你们有素食选择吗?
  22. What’s the best thing on the menu? 菜单上最好的菜是什么?
  23. Could you recommend a good restaurant? 你能推荐一家好的餐厅吗?
  24. Could you recommend a good restaurant around here? 你能推荐一个附近不错的餐厅吗?
  25. Could you recommend a good hotel around here? 你能推荐一家附近不错的酒店吗?
  26. Could you recommend a good book for me? 你能给我推荐一本好书吗?
  27. Could you recommend something? 你能推荐点什么吗?
  28. What do you recommend? 你推荐什么?
  29. Could you recommend some local dishes? 你能推荐些当地的菜吗?
  30. Could you recommend a local dish to try? 你能推荐一个当地菜品吗?
  31. I’d love to try the local food. 我很想尝试当地的食物。
  32. Can I get this to - go? 我可以打包这个吗?
  33. Can you pack this to go? 你能把这个打包吗?
  34. I’ll have the same thing as them. 我点跟他们一样的。
  35. I’m just browsing, thanks. 我只是随便看看,谢谢。
  36. I’m just looking, thanks. 我只是随便看看,谢谢。
  37. Do you have this in a different color? 你们有其他颜色的吗?
  38. Can I try this on? 我可以试穿一下吗?
  39. Can I have a copy of the receipt? 我可以要一份收据吗?
  40. Can you give me a receipt for this? 你可以给我这个的收据吗?
  41. That’s a rip - off. 这简直是抢钱。
  42. That’s too expensive. 太贵了。

旅游与活动相关

  1. Can you recommend a good place to visit? 你能推荐个好玩的地方吗?
  2. Could you suggest some places to visit? 你可以推荐一些值得去的地方吗?
  3. What are the main attractions in this area? 这一带的主要景点是什么?
  4. Do you have any brochures or maps? 你们有宣传册或地图吗?
  5. Do you have any brochures about local attractions? 你有关于当地景点的宣传册吗?
  6. Are there any events happening this week? 这周有活动吗?
  7. Do you offer guided tours? 你们提供导游服务吗?
  8. Can I take photos here? 我能在这里拍照吗?
  9. Is it safe to walk around at night? 晚上在这里走安全吗?
  10. What’s the temperature like today? 今天的温度怎么样?
  11. What’s the weather like today? 今天天气怎么样?
  12. What’s the weather forecast for tomorrow? 明天的天气预报是什么?
  13. I’m interested in learning more about your culture. 我对了解你的文化很感兴趣。
  14. Could you tell me more about your culture? 你能多告诉我一些关于你们文化的事情吗?
  15. Can I make an international call here? 我可以在这里打国际电话吗?
  16. Do you have Wi - Fi here? 这里有无线网络吗?
  17. What’s your Wi - Fi password? 你们的Wi - Fi密码是什么?
  18. How do I connect to the Wi - Fi here? 我该如何连接这里的Wi - Fi?
  19. Can I leave my luggage here? 我可以把行李寄存在这里吗?
  20. What are the opening hours? 营业时间是几点到几点?

日常交流其他表达

注: 都很重要, 就不加粗了

  1. Let me think about it. 让我想一想。
  2. Let’s take a break. 我们休息一下吧。
  3. Let’s keep in touch. 我们保持联系吧。
  4. I’m running late. 我快要迟到了。
  5. I’m on my way. 我正在路上。
  6. I’ll be back in a minute. 我马上回来。
  7. I’ll be right back. 我马上回来。
  8. I’ll take care of it. 我会处理的。
  9. I’ll get back to you. 我会回复你的。
  10. I’ll give it a shot. 我试试看。
  11. I’ll cross that bridge when I come to it. 到时候再说。
  12. I’ll keep that in mind. 我会记住的。
  13. I’m looking forward to it. 我很期待。
  14. I’m looking forward to meeting you. 我很期待见到你。
  15. I’m looking forward to working with you. 我很期待和你合作。
  16. I’m proud of you. 我为你感到骄傲。
  17. Congratulations! 恭喜!
  18. You did a great job! 你干得很好!
  19. You’re a lifesaver. 你真是我的救星。
  20. That’s very kind of you. 你真是太好了。
  21. Thank you for your help! 感谢你的帮助!
  22. Thanks for your help, I really appreciate it. 谢谢你的帮助,我真的很感激。
  23. You’re welcome. 不客气。
  24. Don’t mention it. 别客气。
  25. It’s my pleasure. 这是我的荣幸。
  26. Sorry, I’m late. 很抱歉我迟到了。
  27. I’m sorry to bother you. 很抱歉打扰你。
  28. I’m sorry to interrupt. 很抱歉打断了。
  29. Sorry for the inconvenience. 抱歉造成不便。
  30. Sorry for the trouble. 抱歉添麻烦了。
  31. I’m sorry, I didn’t mean to. 抱歉,我不是故意的。
  32. It doesn’t matter. 没关系。
  33. That’s not a problem. 那不是问题。
  34. Don’t worry about it. 别担心。
  35. Please don’t worry about it. 不要担心这件事。
  36. Take it easy. 别紧张,放轻松。
  37. Relax. 放松。
  38. Don’t lose your temper. 别发脾气。
  39. Don’t make a scene. 别闹了。
  40. Don’t push me. 别逼我。
  41. Don’t beat around the bush. 别拐弯抹角。
  42. Don’t jump to conclusions. 别急着下结论。
  43. Don’t judge a book by its cover. 别以貌取人。
  44. Don’t judge too quickly. 别太快下结论。
  45. Don’t cry over spilled milk. 覆水难收。
  46. Don’t put all your eggs in one basket. 别把所有鸡蛋放在一个篮子里。
  47. Don’t put the cart before the horse. 本末倒置。
  48. Don’t bite off more than you can chew. 不要贪多嚼不烂。
  49. Don’t burn bridges. 不要断了后路。
  50. Don’t cry wolf. 别发假警报。
  51. Let’s call it a day. 今天就到这里吧。
  52. Let’s get started. 我们开始吧。
  53. Let’s make a move. 我们行动吧。
  54. Let’s grab some coffee. 我们去喝杯咖啡吧。
  55. Let’s grab a bite. 一起吃点东西吧。
  56. Let’s split the bill. 我们分摊账单吧,我们AA吧。
  57. Let’s go the extra mile. 我们再加把劲。
  58. Let me sleep on it. 让我再想想。
  59. Let me explain. 让我解释一下。
  60. Time flies! 时光飞逝。
  61. Time heals all wounds. 时间会治愈一切。
  62. Time will tell. 时间会证明一切。
  63. Actions speak louder than words. 行动胜于言语。
  64. Practice makes perfect. 熟能生巧。
  65. Better safe than sorry. 宁可小心也不要后悔。
  66. It’s better to be safe than sorry. 小心为上。
  67. You can’t have your cake and eat it too. 鱼与熊掌不可兼得。
  68. It’s not rocket science. 这没那么复杂。
  69. It’s a piece of cake. 小菜一碟。
  70. It’s a long story. 说来话长。
  71. It’s a storm in a teacup. 小题大做。
  72. It’s the tip of the iceberg. 这是冰山一角。
  73. It’s a win-win situation. 双赢的局面。
  74. It’s a blessing in disguise. 因祸得福。
  75. It’s not the end of the world. 这不是世界末日。
  76. It’s water under the bridge. 过去的事就算了。
  77. It’s now or never. 机不可失。
  78. You’ve gone too far. 你太过分了。
  79. You nailed it! 你搞定了。
  80. You’ve made my day. 你让我今天非常开心。
  81. You’re as cool as a cucumber. 你真沉着冷静。
  82. I’m all ears. 我洗耳恭听。
  83. I’m all set. 我都准备好了。
  84. I’m good at multitasking. 我擅长同时处理多项任务。
  85. I’m over the moon. 我开心极了。
  86. I’m feeling blue. 我有点忧郁。
  87. I’m feeling under the weather. 我感觉不太舒服。
  88. I’m sick and tired of it. 我厌倦了。
  89. I’m broke. 我没钱了。
  90. I’m in a hurry. 我赶时间。
  91. I’m in hot water. 我有麻烦了。
  92. I’m behind schedule. 我进度落后了。
  93. I’m on the fence. 我还没决定。
  94. I’m starving. 我快饿死了。
  95. That’s ridiculous. 那太荒谬了。
  96. That’s a no-brainer. 这还用想吗。
  97. That’s the last straw. 这是最后一根稻草。
  98. That’s food for thought. 值得深思。
  99. Count me in. 算我一个。
  100. Cross your fingers. 祝你好运。
  101. Keep your fingers crossed. 祝你好运。
  102. Keep up the good work. 继续保持好表现。
  103. Keep your chin up. 打起精神。
  104. Break a leg! 祝你好运。
  105. Don’t blow it. 别搞砸了。
  106. Don’t hold your breath. 别抱太大希望。
  107. Don’t put off till tomorrow what you can do today. 今日事今日毕。
  108. I’ll take your word for it. 我相信你说的。
  109. I can manage it. 我能应付。
  110. I can’t wait! 我等不及了!
  111. I can’t hear you clearly. 我听不清楚你说的。
  112. I forgot to bring my wallet. 我忘了带钱包。
  113. I’m afraid I can’t make it. 我恐怕做不到。
  114. I’m afraid I can’t help you. 我恐怕帮不了你。
  115. Can I borrow your pen? 我能借你的笔吗?
  116. Could you lend me a pen? 你能借我一支笔吗?
  117. Can I have an extra blanket, please? 我可以要一条额外的毯子吗?
  118. Can I have extra towels, please? 我可以要多一些毛巾吗?
  119. Do you offer laundry services here? 这里提供洗衣服务吗?
  120. Could you pass me the salt, please? 你能递给我盐吗?
  121. How do you spell that? 这个怎么拼写?
  122. What’s the emergency contact number here? 这里的紧急联系电话是多少?
  123. What’s the emergency number here? 这里的紧急联系电话是多少?
  124. Do you have any plans for the weekend? 你周末有什么计划吗?
  125. Let’s catch up later. 我们稍后聊。
  126. Are you kidding me? 你在开玩笑吧。
  127. You’ve got to be kidding me. 你一定是在开玩笑。
  128. Can I get a refund? 我可以退款吗?
  129. Could I have a refill, please? 我可以再加点吗?
  130. Is tipping customary here? 在这里小费是习惯吗?
  131. Where can I exchange currency? 我在哪里可以兑换货币?
  132. What’s the exchange rate today? 今天的汇率是多少?
  133. I’d like to exchange some currency. 我想兑换一些货币。
  134. Do I need a reservation? 我需要预订吗?
  135. Can I reserve a table for tonight? 我可以预定今晚的餐桌吗?
  136. Do I need a ticket to enter this place? 进入这个地方需要票吗?
  137. Can I use your phone to make a local call? 我可以用你的电话打个本地电话吗?
  138. Can I get a guide to explain the history here? 我可以找一个导游来讲解这里的历史吗?
  139. Could you take a picture for me? 你可以帮我拍张照片吗?
  140. Could you write it down for me? 你能帮我写下来吗?
  141. Could you write that down for me? 你能帮我写下来吗?
  142. Please feel free to contact me. 请随时联系我。
  143. Do you mind if I join you? 你介意我加入吗?
  144. Do you mind if I sit here? 你介意我坐在这吗?
  145. This is not what I expected. 这不是我期待的。
  146. Let me know if you need anything. 如果你需要什么,请告诉我。
  147. I have nothing to do with it. 这与我无关。
  148. It’s my turn. 轮到我了。
  149. What’s the plan? 计划是什么?
  150. What’s the next step? 下一步是什么?
  151. It’s up to you. 这由你决定,这取决于你。
  152. That’s up to you. 这取决于你。
  153. The ball is in your court. 轮到你行动了。
  154. It’s up in the air. 还不确定。
  155. Stay tuned. 敬请关注。
  156. I’m just joking. 我只是开玩笑。
  157. Don’t judge a person by appearance. 不要以貌取人。

英语俗语谚语

注: 都很重要, 就不加粗了

  1. All roads lead to Rome. 条条大路通罗马。
  2. An apple a day keeps the doctor away. 一天一苹果,医生远离我。
  3. Out of sight, out of mind. 眼不见,心不烦。
  4. Don’t put all your eggs in one basket. 别把所有的鸡蛋放在一个篮子里(不要孤注一掷)。
  5. Easy come, easy go. 来得容易去得快。
  6. Knowledge is power. 知识就是力量。

2. Don’t let the cat out of the bag

意思:别泄露秘密。
比喻用法:指不小心提前说出本该保密的事情。
由来:

  • 起源于中世纪欧洲市场,有个说法是有人用装在袋子里的猫来冒充猪,买家若提前看袋子就识破了骗局,“猫就从袋子里出来了”。

3. Let’s play it by ear

意思:我们到时候看情况再决定。
比喻用法:不提前计划,临场应对。
由来:

  • 原指音乐中“凭耳朵弹奏”,即不看乐谱、即兴发挥。
  • 引申为处理事情时不设定严格计划,根据实际情况灵活应对。

4. Let’s turn over a new leaf

意思:让我们重新开始 / 改过自新。
比喻用法:做出积极改变,开始新生活或改正错误。
由来:

  • “Leaf” 原指书页,“翻一页”意味着翻过旧的、开始新的篇章。

5. Let’s cut to the chase

意思:我们直接进入重点吧。
比喻用法:不要废话,直接讲最重要的部分。
由来:

  • 源自早期电影术语,特别是西部片中,观众最期待的是“追车场景”(chase scenes),所以跳过无聊对话直接进入高潮场面。

6. You’re barking up the wrong tree

意思:你搞错对象了 / 找错地方了。
比喻用法:在错误的方向上努力或责怪了错的人。
由来:

  • 来源于狩猎场景,狗对着没有猎物的树狂吠,误以为猎物藏在那里。

7. You’re pulling my leg

意思:你在逗我 / 开我玩笑吧。
比喻用法:用于质疑对方说的话太离谱,可能是在开玩笑。
由来:

  • 有多种说法,其中一种认为它起源于街头小偷作案时拉拽他人腿部以转移注意力。

8. I’m on cloud nine

意思:我高兴极了 / 我欣喜若狂。
比喻用法:描述极度开心或满足的情绪。
由来:

  • “Cloud nine” 代表最顶层的云,比喻达到最高层次的快乐。其来源可能与气象分级有关(如气象局曾用第九类云指高积云)。

9. That’s the icing on the cake

意思:这真是锦上添花。
比喻用法:事情本已很好,又额外加上一点更好的结果。
由来:

  • 原指蛋糕上本已好吃的糖霜(icing),比喻已有好事上的“附加好处”。

const和volatile和mutable讲解

Posted on 05-24-2015 | In Misc

const关键字

const 是比较常见的关键字, 也是非常好的预防错误的手段.

const 修饰普通变量和指针

const 修饰变量,一般有两种写法:

const TYPE value;

TYPE const value;

这两种写法在本质上是一样的。它的含义是:const 修饰的类型为 TYPE 的变量 value 是不可变的。对于一个非指针的类型 TYPE,无论怎么写,都是一个含义,即 value 值不可变。 例如:

const int nValue;    //nValue 是 const

int const nValue;    //nValue 是 const

. . .

1…202122232425262728293031323334353637
Mike

Mike

🚙 🚗 💨 💨 If you want to create a blog like this, just follow my open-source project, "hexo-theme-neo", click the GitHub button below and check it out ^_^ . It is recommended to use Chrome, Safari, or Edge to read this blog since this blog was developed on Edge (Chromium kernel version) and tested on Safari.

11 categories
290 posts
111 tags
about
GitHub Spotify
© 2013 - 2025 Mike