In daily code writing, we often use try/catch, fori loops, etc. We can add these codes to the real-time template of phpstorm to quickly generate code with a few letters,
1=> Click file→settings in the upper left corner
2=> editor→live templates→choose the written code language, take PHP as an example→click on the right side +→live templates
3=>Fill in the code abbreviation, code description and code content; take the fori loop as an example
4=>Click define to select the environment where the real-time template takes effect; here we choose PHP
5=>Finally click Apply, OK; at this time, a real-time template of a fori loop is added
After that, we only need to enter fori in the code to quickly associate the corresponding code
Recommend several commonly used real-time templates here
tryc=>try/catch
try {
$req = $this->request->post();
$this->success('请求成功');
} catch (Exception $e) {
$this->error($e->getMessage());
}
ifstrpos=>string contains
if(strpos('abcde','abc') !== false){
echo '包含abc';
}else{
echo '不包含abc';
}