phpstorm 代码格式化删除多余的空格

2019-03-28  本文已影响0人  空气KQ

有时候我们写了很多行,我们有些不想要,我们就需要把他给删除掉
比如如下代码

  foreach ($only_index as $c) {
            //自动获取
            $controller = str_replace('Controller', '', $c);


            $controller_path = strtolower($controller);

            
            $route->get($controller_path, $c . '@index');

            $route->any($controller_path . '/api/json', ['uses' => $c . '@apiJson']);
            if (in_array($c, ['OrderController', 'PayForController'])) {
                $route->get($controller_path . '/show/{id}', ['uses' => $c . '@show']);
            }
            if (in_array($c, ['OrderHandleApiController'])) {
                //订单处理
                $route->get($controller_path . '/handle/{order_id}/{type}', 'OrderHandleApiController@handle');
                $route->post($controller_path . '/handle/post/{order_id}/{type}', 'OrderHandleApiController@handlePost');
            }
        }

现在我想要去掉这些空行,那么我们只需要配置php code即可


image.png

现在我们再执行ctrl+alert+l就可以格式化了。

上一篇 下一篇

猜你喜欢

热点阅读