无法在服务器中创建目录 [英] Directory not creating in Server

查看:69
本文介绍了无法在服务器中创建目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,
我正在使用代码创建商店柜台目录.该代码在本地工作正常,但是当我将其放在服务器上时,会在其中创建目录/文件夹.

请检查以下代码,如果有发现,请给我发送任何解决方案.

Hi Friends,
I am using a code for creating a directory for store counter. the code working fine in local but when i put this on server, there is directory/folder creating there.

Pls check the below code and send me any solution, if you find.

<?php
if (!isset($_SESSION))    {
    session_start();
}
$page = urlencode($_SERVER['PHP_SELF'].$_SERVER['QUERY_STRING'].'.counter');

if (!file_exists('counter/'))    {
    mkdir('counter');
}

$visits = file_exists('counter/'.$page) ? (int)file_get_contents('counter/'.$page) : 0;
if (!isset($_SESSION['counter']))    {
    $visits++;
    createFile('counter/'.$page,$visits);
    $_SESSION['counter'] = 'counted';
}

function createFile($file,$content)    {
    $mode='w+';
    $fp = fopen($file,$mode);
    fwrite($fp,$content);
    fclose($fp);
}

?>




谢谢




Thanks

推荐答案

_SESSION)){ session_start(); }
_SESSION)) { session_start(); }


页面 = urlencode(
page = urlencode(


_SERVER [ PHP_SELF'].
_SERVER['PHP_SELF'].


这篇关于无法在服务器中创建目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆