zoukankan      html  css  js  c++  java
  • php 在linux系统下写出文件问题

    最近写了一个简单的生成文件,服务器用的linux 但是在将文件写出到路径的时候就会写出一个其他的文件夹

    http://img.mukewang.com/58edb33e0001f77605720103.jpg

    其中一些代码如下

    <?php

    define("paddy",dirname(__FILE__));

    $gk=request_uri();

    $filepath=paddy.$gk;

    createfile($filefath,$file);

    //$file就是一个需要写出的文件

    function createfile($v,$s){

    $dir=dirname($v);

    if(!is_dir($v)){

    mkdir($v,755,1);

    }

    file_get_contents($v,$s);

    }

    function request_uri()

    {

        if (isset($_SERVER['REQUEST_URI']))

        {

            $uri = $_SERVER['REQUEST_URI'];

        }

        else

        {

            if (isset($_SERVER['argv']))

            {

                $uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['argv'][0];

            }

            else

            {

                $uri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'];

            }

        }

        return $uri;

    }

    ?>

    如果我不用常量也定义路径,只用一个指定的路径,就不会生成乱符号的文件夹

    乱符号的文件夹具体路径如下:/home/wwwroot/1/hh/%7B%E5%AD%98%E6%94%BE%E7%9B%AE%E5%BD%95%7Dcss/%3Cbr%20/%3E%3Cb%3ENotice%3C/b%3E:%20%20Undefined%20variable:%20jsname%20in%20%3Cb%3E/home/wwwroot/1/paddy/mb/0.php%3C/b%3E%20on%20line%20%3Cb%3E11%3C/b%3E%3Cbr%20

    paddy常量 定义的就是 /home/wwwtoot/1/

    求大神解决办法!

    http://www.lfgzjt.com/

    http://www.cpokooo.com/

    http://www.buy700.com

    http://www.hhyeyp.com/sitemap/

  • 相关阅读:
    Redis源代码分析(十三)--- redis-benchmark性能測试
    kvm中运行kvm
    umount.nfs device busy day virsh extend diskSpace, attachDisk
    ultravnc
    openNebula dubug
    maintenance ShellScripts
    virsh VMI deploy data serial xml
    cloud computing platform,virtual authentication encryption
    基于C 的libvirt 接口调用
    storage theory
  • 原文地址:https://www.cnblogs.com/paddygege/p/6707904.html
Copyright © 2011-2022 走看看