search
HomeBackend DevelopmentPHP TutorialPHPStrom中实用的功能和快捷键大全_PHP

有哪些快捷键或者PHPStrom出的特有的功能,让你觉得编写过程变得很舒服和快捷?

CTRL + j 能够快捷的输入常用的代码片段,类似vim的 snipMate,可以加入自定义代码片段

find every thing phpstorm 支持类名、文件名等的单独搜索,我常用的是直接全部搜索。find every thing 需要自定义快捷键

很精确的函数、类名、变量等的定位,支持命名空间。不得不承认做的的确很好,比vim + ctag好太多了

alt + F7 find usages 功能,可以很方便的找到函数在哪里调用了

shift + F6 重命名 可以很方便的重命名方法和变量名等等。甚至文件的重命名,也会自动修正 include filepath(貌似仅限于简单路径,路径中包含了变量的无法识别。常量没问题)

可以安装 vim插件,同样享受 vim 的快捷操作

ctrl+alt+l 代码格式化

如果你的测试代码要通过 ftp 上传到测试机 Tools->deployment 功能必须配置下,自动上传修改的文件到测试机

不仅仅是 svn还有 git都有很好的支持

可以配置断点调试,参考 http://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm 本身不常用

支持的php版本很新。当前的 phpstorm7 支持php5.5。接下来的phpstorm8支持Php5.6。

函数中未使用的变量是灰色的。使用未定义的变量会有红色下划线提示。提示变量很好的减少了手误

以上是我常用的,还有很多功能比如对composer phpunit的支持也没用过。这些习惯命令行操作了

1. 项目名右键选择"Local History | Show History"可查看本地修改记录

2. Ctrl + E 可查看最近打开文件或项目

3. 打开File | Setting | Editor,选择Appearance下面的Show Method Separators。它会将你的代码按方法,用灰色线框进行智能分割。你还可以使用:alt+↑或↓,在方法之间进行跳转

4. Ctrl + Shift + V,可选择要粘贴的最近内容

5. Ctrl + D,复制粘贴选中的文本

6. Ctrl + Y,删除当前行或选中行

7. Ctrl + Alt + 左右方向键,定位到上一次编辑的位置

8. Alt + 上下方向键,跳转到上/下函数

9. Alt + 左右方向键,导航标签切换

10. Ctrl + N,根据类名称查找

11. Ctrl + Shift + N,根据文件名查找

12. Ctrl + Shift + Alt + N,根据函数名查找

13. Ctrl + Shift + F,Find in Path

14. Ctrl + Shift + I,查看变量初始化的值

15. Ctrl + F12,快速查看当前文件的所有方法

16. Ctrl + /,单行注释

17. Ctrl + Shift + /,多行注释

18. 修改默认打开的文件模版:"file" ---> "setting" --->"file and code template"

19. /** + Enter,自动生成注释

20. Ctrl + Alt + L,格式化代码

phpstorm常用快捷键大全

mac电脑phpstorm快捷键

    command + a 全选

   command + c 复制

    command + v 粘贴

   command + z 撤消

    command + k 代码搜索

    command + l 输入行号跳到某一行

    command + o 查看一个类的结构

    command + / 单行注释

    command + e 列出最后打开的文件

    ctrl + shift + / 块注释

    shift + command + x

    shift + command + r 按文件名搜索对应文件所在路径

    shift + command + t 按类名搜索对应文件所在路径

    shift + command + c 复制当前文件所在路径

    选中左侧的文件名  shift + f6(mac需要同时按住键) 进行文件重命名

windows下phpstorm的快捷键

ctrl+shift+n查找文件

ctrl+shift+f 在一个目录里查找一段代码(ctrl+f的升级版)

ctr+shift+r 在一个目录里查找一段代码并替换(ctrl+r的升级版)

CTRL+ALT ←/→  返回上次编辑的位置

ALT+ ←/→  切换代码视图,标签切换

ALT+ ↑/↓  在方法间快速移动定位

ctrl+j插入活动代码提示

ctrl+alt+t当前位置插入环绕代码

alt+insert生成代码菜单

ctrl+q查看代码注释

ctrl+d复制当前行

ctrl+y删除当前行

shift+F6重命名

ctrl+shift+u字母大小写转换

ctrl+f查找

ctrl+r替换

F4查看源码

ctrl+shift+i查看变量或方法定义源

ctrl+g跳转行

ctrl+alt+F12跳转至当前文件在磁盘上的位置

alt+down查看下一个方法

alt+up查看上一个方法

ctrl+alt+l重新格式化代码

ctrl+shift+downstatement向下移动

ctrl+shift+upstatement向上移动

alt+shift+downline向下移动

alt+shift+upline向上移动

ctrl+/行注释

ctrl+shift+/块注释

ctrl+shift+n打开工程中的文件

ctrl+b跳到变量申明处

ctrl+[]匹配 {}[]

ctrl+shift+]/[选中块代码

ctrl+x剪切行

ctrl+shift+v复制多个文本

alt+left/right标签切换

ctrl+p显示默认参数

ctrl+F12在当前类文件里快速查找方法

--------------------------------------------------------------

phpstorm快捷键:

// ctrl+shift+n 查找文件

// ctrl+j 插入活动代码提示

// ctrl+alt+t 当前位置插入环绕代码

// alt+insert 生成代码菜单

// ctrl+q 查看代码注释

// ctrl+d 复制当前行

// ctrl+y 删除当前行

// shift+F6 重命名

// ctrl+shift+u 字母大小写转换

// ctrl+f 查找

// ctrl+r 替换

// F4 查看源码

// ctrl+shift+i 查看变量或方法定义源

// ctrl+g 跳转行

// ctrl+alt+F12 跳转至当前文件在磁盘上的位置

// alt+down 查看下一个方法

// alt+up 查看上一个方法

// ctrl+alt+l 重新格式化代码

// ctrl+shift+down statement向下移动

// ctrl+shift+up statement向上移动

// alt+shift+down line向下移动

// alt+shift+up line向上移动

// ctrl+/ 行注释

// ctrl+shift+/ 块注释

// ctrl+shift+n 打开工程中的文件

// ctrl+b 跳到变量申明处

// ctrl+[] 匹配 {}[]

// ctrl+shift+]/[ 选中块代码

....

// ctrl+x 剪切行

// ctrl+shift+v 复制多个文本

// alt+left/right 标签切换

// ctrl+p 显示默认参数

// ctrl+F12 在当前类文件里快速查找方法

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How can you protect against Cross-Site Scripting (XSS) attacks related to sessions?How can you protect against Cross-Site Scripting (XSS) attacks related to sessions?Apr 23, 2025 am 12:16 AM

To protect the application from session-related XSS attacks, the following measures are required: 1. Set the HttpOnly and Secure flags to protect the session cookies. 2. Export codes for all user inputs. 3. Implement content security policy (CSP) to limit script sources. Through these policies, session-related XSS attacks can be effectively protected and user data can be ensured.

How can you optimize PHP session performance?How can you optimize PHP session performance?Apr 23, 2025 am 12:13 AM

Methods to optimize PHP session performance include: 1. Delay session start, 2. Use database to store sessions, 3. Compress session data, 4. Manage session life cycle, and 5. Implement session sharing. These strategies can significantly improve the efficiency of applications in high concurrency environments.

What is the session.gc_maxlifetime configuration setting?What is the session.gc_maxlifetime configuration setting?Apr 23, 2025 am 12:10 AM

Thesession.gc_maxlifetimesettinginPHPdeterminesthelifespanofsessiondata,setinseconds.1)It'sconfiguredinphp.iniorviaini_set().2)Abalanceisneededtoavoidperformanceissuesandunexpectedlogouts.3)PHP'sgarbagecollectionisprobabilistic,influencedbygc_probabi

How do you configure the session name in PHP?How do you configure the session name in PHP?Apr 23, 2025 am 12:08 AM

In PHP, you can use the session_name() function to configure the session name. The specific steps are as follows: 1. Use the session_name() function to set the session name, such as session_name("my_session"). 2. After setting the session name, call session_start() to start the session. Configuring session names can avoid session data conflicts between multiple applications and enhance security, but pay attention to the uniqueness, security, length and setting timing of session names.

How often should you regenerate session IDs?How often should you regenerate session IDs?Apr 23, 2025 am 12:03 AM

The session ID should be regenerated regularly at login, before sensitive operations, and every 30 minutes. 1. Regenerate the session ID when logging in to prevent session fixed attacks. 2. Regenerate before sensitive operations to improve safety. 3. Regular regeneration reduces long-term utilization risks, but the user experience needs to be weighed.

How do you set the session cookie parameters in PHP?How do you set the session cookie parameters in PHP?Apr 22, 2025 pm 05:33 PM

Setting session cookie parameters in PHP can be achieved through the session_set_cookie_params() function. 1) Use this function to set parameters, such as expiration time, path, domain name, security flag, etc.; 2) Call session_start() to make the parameters take effect; 3) Dynamically adjust parameters according to needs, such as user login status; 4) Pay attention to setting secure and httponly flags to improve security.

What is the main purpose of using sessions in PHP?What is the main purpose of using sessions in PHP?Apr 22, 2025 pm 05:25 PM

The main purpose of using sessions in PHP is to maintain the status of the user between different pages. 1) The session is started through the session_start() function, creating a unique session ID and storing it in the user cookie. 2) Session data is saved on the server, allowing data to be passed between different requests, such as login status and shopping cart content.

How can you share sessions across subdomains?How can you share sessions across subdomains?Apr 22, 2025 pm 05:21 PM

How to share a session between subdomains? Implemented by setting session cookies for common domain names. 1. Set the domain of the session cookie to .example.com on the server side. 2. Choose the appropriate session storage method, such as memory, database or distributed cache. 3. Pass the session ID through cookies, and the server retrieves and updates the session data based on the ID.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!