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
| 注:在ubnutu16.04 php7.0的环境下 | |
| ### Thinkphp5 | |
| ``` | |
| server { | |
| listen 80; | |
| server_name url ; | |
| root /var/www/html/xxx/public/; |
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
| ``` | |
| # 定义示例类型和变量 | |
| type Human struct { | |
| Name string | |
| } | |
| var people = Human{Name:"zhangsan"} | |
| ``` | |
| ``` | |
| 普通占位符 |
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
| ———文章来源 [YamiOdymel/PHP-to-Golang](https://github.com/YamiOdymel/PHP-to-Golang/) | |
| # 为什么从PHP 转到Golang? | |
| PHP和模块之间的关系令人感到烦躁,假设你要读取`yaml`档案,你需要有一个`yaml`的模块,为此,你还需要将其编译然后将编译后的模块摆放至指定位置,之后换了一台伺服器你还要重新编译,这点到现在还是没有改善;顺带一提之后出了PHP 7效能确实提升了许多(比Python 3快了些),但PHP仍令我感到臃肿,我觉得是时候 | |
| (转行)了。 | |
| PHP 和Golang 的效能我想毋庸置疑是后者比较快(而且是以倍数来算),也许有的人会认为两种不应该被放在一起比较,但Golang 本身就是偏向Web 开发的,所以这也是为什么我考虑转用Golang 的原因,起初我的考虑有几个:Node.js 和Rust 还有最终被选定的Golang;先谈谈Node.js 吧。 | |
| ## Node.js |
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
| **发送一条sql语句,并且在sql语句错误的时候输出sql的错误信息** | |
| >$sql 要发送的sql语句 | |
| function query($sql){ | |
| // 发送一条查询语句 | |
| $res = mysql_query($sql); | |
| // 如果sql语句错误,输出错误信息 并退出脚本 如果成功,返回结果集 | |
| if(!$res){ | |
| echo mysql_error().'<br />'; |
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
| ##### 安装Apache | |
| ``` | |
| sudo apt-get install apache2 | |
| ``` | |
| ##### 安装MySQL | |
| ``` | |
| sudo apt-get install mysql-server mysql-client | |
| ``` |
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
| ##### 创建sshkey | |
| ``` | |
| ssh-keygen -t rsa -C "用户邮箱" | |
| ``` | |
| ##### 设置用户名和Email地址 | |
| ``` | |
| git config --global user.name "your name" | |
| git config --global user.email "email@xxxxx.com" | |
| ``` | |
| ##### 建立仓库,初始化 |
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
| 本脚本适用环境 | |
| 系统支持:CentOS 6+,Debian 7+,Ubuntu 12+ | |
| 内存要求:≥128M | |
| 日期 :2017 年 10 月 22 日 | |
| ##### 关于本脚本 | |
| 1、一键安装 Shadowsocks-Python, ShadowsocksR, Shadowsocks-Go, Shadowsocks-libev 版(四选一)服务端; | |
| 2、各版本的启动脚本及配置文件名不再重合; | |
| 3、每次运行可安装一种版本; | |
| 4、支持以多次运行来安装多个版本,且各个版本可以共存(注意端口号需设成不同); |
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
| laravel性能优化的方法,分为四个点: | |
| ###### 1.自带命令 | |
| ###### 2.debugbar | |
| ###### 3.预加载 | |
| ###### 4.慢sql查询 | |
| #### 自带命令 | |
| ###### 路由缓存优化 | |
| 注:路由文件里不要写路由函数 | |
| ``` |
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
| ### 表 | |
| users | |
| ``` | |
| CREATE TABLE `users` ( | |
| `id` int(10) unsigned NOT NULL AUTO_INCREMENT, | |
| `name` varchar(255) NOT NULL, | |
| `email` varchar(255) NOT NULL, | |
| `remember_token` varchar(100) DEFAULT NULL, | |
| `created_at` timestamp NULL DEFAULT NULL, | |
| `updated_at` timestamp NULL DEFAULT NULL, |
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
| #### 1.简单查询: | |
| ``` | |
| one(): 根据查询结果返回查询的第一条记录。 | |
| all(): 根据查询结果返回所有记录。 | |
| count(): 返回记录的数量。 | |
| sum(): 返回指定列的总数。 |
NewerOlder