简体   繁体   English

当HTML文件完全加载后,如何使php标头在几秒钟后执行

[英]how to make php header execute after some second when the html file load completely

i have problem when i'm trying to read page and convert it to doc file 我在尝试阅读页面并将其转换为doc文件时遇到问题

everything is fine but because i'm using angularJs in the page it read the command of angular inside my doc file 一切都很好,但是因为我在页面中使用angularJs,所以它在我的doc文件中读取了angular的命令

$contents = View::make('EmployeeDownloadCv');


$headers = array(
    "Content-type"=>"text/html",
    "Content-Disposition"=>"attachment;Filename=myfile.doc"
);



return Response::make($contents,200, $headers);

what i mean is the file doesn't read the data which came from angular because angular need at least 2 second to load the data but header php read the file before this 2 second 我的意思是该文件无法读取来自angular的数据,因为angular需要至少2秒才能加载数据,但标头php会在此2秒之前读取文件

any idea please 任何想法请

my result now contain @{{user}} but i expect to get instead of @{{user}} the real name if user which came from angular function 我的结果现在包含@ {{user}},但是如果来自角度函数的用户希望获得真实姓名,而不是@ {{user}}

i'm working with laravel now but the problem is same on pure php 我现在正在使用laravel,但纯PHP上的问题相同

any suggest please 任何建议请

you could try for a while ... to sleep before your header ... http://php.net/manual/en/function.sleep.php sleep(3); 您可以尝试一段时间……在标题之前先 入睡 …… http://php.net/manual/en/function.sleep.php sleep(3);

Seem that i had not well understand the question, so maybe this will help and is what you're searching for: http://php.net/manual/it/function.ob-get-contents.php 似乎我还不太了解这个问题,所以也许这会有所帮助,这就是您要搜索的内容: http : //php.net/manual/it/function.ob-get-contents.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM