laravel - php包独立philo/laravel-blade给黑屏
问题描述
我正在尝试将这个 php 包与 php 7.0.33 一起使用,但它既没有给出任何错误也没有工作。它只是给一个空白屏幕。下面是我的代码。如何调试?
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require 'vendor/autoload.php';
use Philo\Blade\Blade;
$views = __DIR__ . '/views';
$cache = __DIR__ . '/cache';
$blade = new Blade($views, $cache);
echo $blade->view()->make('hello')->render();
解决方案
首先,你在这里少了一个分号
error_reporting(E_ALL); <-- Missing
这就是为什么它没有显示任何内容
然后确保hello.blade.php
在您的views
文件夹中有一个结构为 HTML的文件
views/hello.blade.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
Hello, World!
</body>
</html>
希望这可以帮助
推荐阅读
- jenkins - Jenkins Pipeline - 使用分支和 1 个其他参数的条件执行(手动)
- python - Python webscraper 在 SQL Server 代理中运行不一致
- django - 无法访问私有 s3 图像,但我可以上传
- forms - 作为道具传递时,寄存器不是函数吗?
- go - 为什么这个 golang 脚本让我陷入僵局?+ 几个问题
- python - I got empty values when converting object to int with pandas
- javascript - 在网页 NodeJS 上获取控制台消息
- c# - PUN 2.0 相机为每个玩家渲染
- java - 如何正确测试 Spring WebSocket 端点?
- javascript - 如何将sqlite作为模块导入另一个文件然后执行?