One aspect of PHP that you need to be careful of, is that ?> will drop you out of PHP code and into HTML even if it appears inside a // comment. (This does not apply to /* */ comments.) This can lead to unexpected results. For example, take this line: <?php $file_contents = '<?php die(); ?>' . "\n"; ?> If you try to remove it by turning it into a comment, you get this: <?php // $file_contents = '<?php die(); ?>' . "\n"; ?> Which results in ' . "\n"; (and whatever is in the lines following it) to be output to your HTML page. The cure is to either comment it out using /* */ tags, or re-write the line as: <?php $file_contents = '<' . '?php die(); ?' . '>' . "\n";
时间: 2024-04-05 09:31:45 浏览: 17
PHP的一个需要注意的方面是,即使它出现在//注释中,?>也会将您从PHP代码中退出,进入HTML代码。 (这不适用于/* */注释。)这可能会导致意外的结果。例如,考虑以下行: <?php $file_contents = '<?php die(); ?>' . "\n"; ?> 如果您尝试通过将其转换为注释来删除它,则会得到以下结果: <?php // $file_contents = '<?php die(); ?>' . "\n"; ?> 这将导致'. "\n";(以及其后面的行)被输出到您的HTML页面。解决方法是使用/* */标签将其注释掉,或将该行重写为: <?php $file_contents = '<' . '?php die(); ?' . '>' . "\n";
相关问题
The supplied data appears to be in the OLE2 Format. You are calling the part of POI that deals with OOXML
"The supplied data appears to be in the OLE2 Format. You are calling the part of POI that deals with OOXML (Office Open XML) Documents. You need to call a different part of POI to process this data (e.g. HSSF instead of XSSF)"这个错误是由于使用了错误的POI部分处理给定的数据格式引起的。您需要调用POI的另一个部分来处理数据。具体来说,如果您处理的是doc文件,应该使用HWPFDocument来读取;如果您处理的是xls文件,应该使用HSSFWorkbook来读取。如果您处理的是docx文件,应该使用XWPFDocument来读取;如果您处理的是xlsx文件,应该使用XSSFWorkbook来读取。请根据您所处理的文件类型选择正确的POI部分进行处理。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [The supplied data appears to be in the OLE2 Format.](https://blog.csdn.net/qq_40014707/article/details/114318042)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [POI OLE2NotOfficeXmlFileException:The supplied data appears to be in the OLE2 Format问题解决](https://blog.csdn.net/qq_38974638/article/details/116210340)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals
"The supplied data appears to be in the Office 2007 XML. You are calling the part of POI that deals with OLE2 Office Documents." 这个错误是由于使用了错误的POI解析类导致的。POI是一个用于操作Microsoft Office文件的开源库,分为HSSF和XSSF两部分,分别用于处理旧版(xls)和新版(xlsx)的Excel文件。当你使用HSSFWorkbook来解析xlsx文件时,就会出现这个错误。正确的处理方法是使用XSSFWorkbook来解析xlsx文件。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [NPOIDemo.zip](https://download.csdn.net/download/qq_23663693/12370014)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [java处理excel库,poi-bin-4.1.0-20190412](https://download.csdn.net/download/cp62/11156022)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals](https://blog.csdn.net/weixin_46205984/article/details/122255403)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)