本文整理汇总了PHP中Whoops\Util\Misc::isCommandLine方法的典型用法代码示例。如果您正苦于以下问题:PHP Misc::isCommandLine方法的具体用法?PHP Misc::isCommandLine怎么用?PHP Misc::isCommandLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Whoops\Util\Misc
的用法示例。
在下文中一共展示了Misc::isCommandLine方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
public function register()
{
if (function_exists('ini_set')) {
ini_set('display_errors', 0);
}
$run = new Run();
$handler = new ErrorHandler();
$run->pushHandler($handler);
$json_handler = new JsonErrorHandler();
$run->pushHandler($json_handler);
if (Misc::isCommandLine()) {
$cli_handler = new PlainTextHandler();
$cli_handler->addTraceFunctionArgsToOutput(true);
$cli_handler->addTraceToOutput(true);
$run->pushHandler($cli_handler);
}
$run->register();
}
示例2: init
public static function init()
{
error_reporting(E_ALL);
if (Config\Config::get('WHOOPS_ERROR', FALSE) || Config\Config::get('DEBUG', FALSE)) {
$whoops = new \Whoops\Run();
$request = \Biome\Biome::getService('request');
if ($request->acceptHtml()) {
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
} else {
if (\Whoops\Util\Misc::isCommandLine()) {
$whoops->pushHandler(new \Whoops\Handler\PlainTextHandler());
} else {
$whoops->pushHandler(new \Whoops\Handler\JsonResponseHandler());
}
}
$whoops->register();
}
}
示例3: WhoopsRun
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================================ */
use Opis\Colibri\Application;
use Whoops\Run as WhoopsRun;
use Whoops\Handler\JsonResponseHandler;
use Whoops\Handler\PrettyPageHandler;
use Whoops\Handler\PlainTextHandler;
use Whoops\Util\Misc;
error_reporting(-1);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('opcache.enable', 0);
$loader = (require_once 'vendor/autoload.php');
if (getenv('APP_PRODUCTION') === false) {
$whoops = new WhoopsRun();
if (Misc::isCommandLine()) {
$whoops->pushHandler(new PlainTextHandler());
} elseif (Misc::isAjaxRequest()) {
$whoops->pushHandler(new JsonResponseHandler());
} else {
$whoops->pushHandler(new PrettyPageHandler());
}
$whoops->register();
}
$app = new Application(__DIR__, $loader);
return $app->bootstrap();