sách gpt4 ai đã đi

php - php word文档代码只读

In lại 作者:行者123 更新时间:2023-12-04 03:09:54 26 4
mua khóa gpt4 Nike

我有一个 php 下载脚本,允许用户在下载后下载一个 word 文档文件,它对用户是可编辑的..我想让文件对用户只读

我的下载代码是:

//php代码

// set headers`enter code here`
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: $mtype");
header("Content-Disposition: attachment; filename=\"$asfname\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . $fsize);

// download
// @readfile($file_path);

$file = @fopen($file_path,"rb");
if ($file) {
while(!feof($file)) {
print(fread($file, 1024*8));
flush();
if (connection_status()!=0) {
@fclose($file);
die();
}
}
@fclose($file);
}

提前谢谢问候

1 Câu trả lời

你不能。文件属性不会随下载一起发送。用户下载文件并拥有它。

您可以用密码保护文档,但您必须自己编辑它。这是 PHP 很难做到的事情,虽然您可以在 Windows 上使用 Word 的 COM 接口(interface)从 PHP 中...但这不是您想要走的路。

关于php - php word文档代码只读,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7370843/

26 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com