PHP下载点击显示下载代码为网页中的html

时间:2016-07-14 09:43:52

标签: php zend-framework

当我点击我的索引页面上的下载按钮,显示按钮下方的下载页面代码为html并且下载不起作用。 下载页面包含解密文件然后下载的代码。

我用于加密的代码是zend,下面给出了它的部分内容。

$options = array(
                // Encryption type - Openssl or Mcrypt
                'adapter' => 'mcrypt', 
                // Encryption algorithm
                'algorithm' => 'rijndael-192', 
                'vector' => '236587hgtyujkirtfgty5678', 
                // Encryption key
                'key' => $secret_key 
                ); 

但是我的代码失败了,它在我的索引页面下面写了下载按钮下面的html。但没有错误信息。

                'mcrypt', 
                // Encryption algorithm
                'algorithm' => 'rijndael-192', 
                'vector' => '236587hgtyujkirtfgty5678', 
                // Encryption key
                'key' => $secret_key 
                );

上面的代码,它继续下载代码,上面代码下面的所有代码都在索引页面中显示为html。

1 个答案:

答案 0 :(得分:0)

如果您的文件扩展名采用.php以外的其他格式,那么您需要配置您的Web服务器以处理任何奇怪的文件扩展名,因为它会处理扩展名为.php的文件。如果你在Apache, 将AddType application / x-httpd-php更改为 除非另有说明,AddType application / x-httpd-php .htm .html可能会有所帮助。