简体   繁体   English

上载php文件时出现问题

[英]Problem when uploading php file

can anybody explain why uploaded php files treated by a server as a text file ? 有人可以解释为什么服务器将上传的php文件视为文本文件吗?

The symptom is when i try to access a php file, the server send me the content of the file. 症状是当我尝试访问php文件时,服务器向我发送了文件的内容。

i have edited and put part of content as asked. 我已经按照要求编辑并放入了部分内容。 This is output i see in the browser 这是我在浏览器中看到的输出

*** WHAT : Removinng Meta Box in Post using $pageshow thing WHY :*****************************************/function bk_cdp_meta_box($pageshow) { switch ($pageshow) { case 'postnew.php' : add_action('dbx_post_advanced', 'bk_cdp_meta_box_reindex'); ***内容:使用$ pageshow东西在帖子中删除元数据框为什么:************************************** ******* / function bk_cdp_meta_box($ pageshow){开关($ pageshow){案例'postnew.php':add_action('dbx_post_advanced','bk_cdp_meta_box_reindex'); break; 打破; case 'pagenew.php' : add_action('page_advanced', 'bk_cdp_meta_box_reindex'); 案例'pagenew.php':add_action('page_advanced','bk_cdp_meta_box_reindex'); break; 打破; default : } if ($pageshow != "") {// remove_meta_box('postcustom', 'post', 'normal');// remove_meta_box('postexcerpt', 'post', 'normal');// remove_meta_box('trackbacks', 'post', 'normal'); 默认值:} if($ pageshow!=“”){// remove_meta_box('postcustom','post','normal'); // remove_meta_box('postexcerpt','post','normal'); // remove_meta_box (“引用通告”,“发布”,“正常”); }}/**************************************** WHAT : Reindex List all of Post panel Metaboxes before get remove or add a new meta_box WHY : FIXME : TODO : RETURN : ARGs :*** }} / ****************************************内容:重新索引列出所有帖子在删除或添加新meta_box之前的面板Metabox中,为什么:FIXME:TODO:RETURN:ARG:***

i download what i have upload and every one of them has <?php as i code it before , so the source of problem exist somewhere else. 我下载了我上传的内容,并且每个人都有<?php,因为我之前编码过 ,所以问题的根源存在于其他地方。

如果您的代码示例来自文件的开头,那么问题是您没有任何打开的PHP标记,例如<?php

you are missing the php open tags and the comment tags are wrong. 您缺少php打开标签,并且注释标签错误。 Try this: 尝试这个:

    <?php
    function bk_cdp_meta_box($pageshow) { 
           switch ($pageshow) { 
              case 'postnew.php' : 
              add_action('dbx_post_advanced', 'bk_cdp_meta_box_reindex'); 
              break; 

              case 'pagenew.php' : 
              add_action('page_advanced', 'bk_cdp_meta_box_reindex'); 
              break; 

              default : 
           } 
       if ($pageshow != "") {
      // remove_meta_box('postcustom', 'post', 'normal');
      // remove_meta_box('postexcerpt', 'post', 'normal');
      // remove_meta_box('trackbacks', 'post', 'normal'); 
     }
}

?>

This might happen if your new uploaded files doesn't get executable attribute and the server is configured to prevent execution of such files. 如果新上传的文件没有可执行文件属性,并且服务器配置为阻止执行此类文件,则可能会发生这种情况。 I've never seen such a thing though. 我从来没有见过这样的事情。

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

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