我正在laravel5中编写一个中间件,我希望通过中间件的代码403通过禁止的异常.我的中间件功能如下.
use Exception;
public function handle($request, Closure $next)
{
if (!Auth::check()) {
throw new Exception("Access denied", 403);
}
return $next($request);
}
Run Code Online (Sandbox Code Playgroud)
我从控制器调用中间件,我收到代码500但不是403的错误消息.我怎么解决这个问题?
当我访问我的内部页面vue-meta时,新页面值不会更新。
app.js
import VueMeta from 'vue-meta'
Vue.use(VueMeta, {
refreshOnceOnNavigation: true
})
Run Code Online (Sandbox Code Playgroud)
App.vue (主要成分)
export default {
metaInfo() {
return {
title: process.env.MIX_APP_NAME,
titleTemplate: `%s | ${process.env.MIX_APP_NAME}`,
meta: [
{ name: "robots", content: "index,follow" },
{
vmid: "description",
name: "description",
content:
"..........",
},
// and many more....
],
}
}
}
Run Code Online (Sandbox Code Playgroud)
post.vue (内部组件)
export default {
name: "singePost",
data() {
return {
post: "",
};
},
metaInfo() {
return {
title: this.post.name, // not receiving data
meta: [ …Run Code Online (Sandbox Code Playgroud) 我有这个yml文件用于在docker中配置MySQL:
# Use root/example as user/password credentials
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: 'pass'
MYSQL_DATABASE: 'db'
MYSQL_USER: 'user'
MYSQL_PASSWORD: 'pass'
adminer:
image: adminer
restart: always
ports:
- 8888:8080
Run Code Online (Sandbox Code Playgroud)
然后使用以下命令从yml所在的同一目录中启动容器:
docker-compose -f stack.yml以上
然后我得到了这个错误:
我知道我们可以使用PHP DOM来使用PHP解析HTML.我在Stack Overflow上发现了很多问题.但我有一个特定的要求.我有一个像下面这样的HTML内容
<p class="Heading1-P">
<span class="Heading1-H">Chapter 1</span>
</p>
<p class="Normal-P">
<span class="Normal-H">This is chapter 1</span>
</p>
<p class="Heading1-P">
<span class="Heading1-H">Chapter 2</span>
</p>
<p class="Normal-P">
<span class="Normal-H">This is chapter 2</span>
</p>
<p class="Heading1-P">
<span class="Heading1-H">Chapter 3</span>
</p>
<p class="Normal-P">
<span class="Normal-H">This is chapter 3</span>
</p>
Run Code Online (Sandbox Code Playgroud)
我想解析上面的HTML并将内容保存到两个不同的数组中,如:
$heading 和 $content
$heading = array('Chapter 1','Chapter 2','Chapter 3');
$content = array('This is chapter 1','This is chapter 2','This is chapter 3');
Run Code Online (Sandbox Code Playgroud)
我可以简单地使用jQuery实现这一点.但我不确定,如果这是正确的方式.如果有人能指出我正确的方向,那就太好了.提前致谢.
现在已经几个小时了,因为我试图弄清楚如何使用Angular下载zip文件。下载的文件小于原始文件。我点击了此链接如何使用Angular2下载文件。
我不只是<a>出于身份验证的原因将标签用于下载。
服务
downloadfile(filePath: string){
return this.http
.get( URL_API_REST + 'downloadMaj?filePath='+ filePath)
.map(res => new Blob([res], {type: 'application/zip'}))
}
Run Code Online (Sandbox Code Playgroud)
零件
downloadfileComponent(filePath: string){
this.appService.downloadfile(filePath)
.subscribe(data => this.getZipFile(data)),
error => console.log("Error downloading the file."),
() => console.log('Completed file download.');
}
getZipFile(data: any){
var a: any = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
var blob = new Blob([data], { type: 'application/zip' });
var url= window.URL.createObjectURL(blob);
a.href = url;
a.download = "test.zip";
a.click();
window.URL.revokeObjectURL(url);
}
Run Code Online (Sandbox Code Playgroud)
休息api
public void downloadMaj(@RequestParam(value = …Run Code Online (Sandbox Code Playgroud) 我想知道如何使用Node.js库向Stripe中的现有客户添加新的银行卡.例如:我有一个客户使用Stripe客户ID:cus_XXXXXXXXXX,此客户已经有1张卡,我想向同一客户添加另一张卡.