小编use*_*608的帖子

如何给apache写入主目录的权限?

我的服务器在/ var/www/html我在/var/www/html/fileio_test/io_test.php中有一个php脚本

<?php

$logging = <<< LOG
This is a test
LOG;

$testfile = fopen('/home/djameson/test.txt', 'a'); 
fwrite ($testfile, $logging);
fclose($testfile);

?>
Run Code Online (Sandbox Code Playgroud)

当我尝试运行这个脚本时,我得到了

Warning: fopen(/home/djameson/test.txt): failed to open stream: Permission denied in   /var/www/html/fileio_test/io_test.php on line 7

Warning: fwrite() expects parameter 1 to be resource, boolean given in /var/www/html/fileio_test/io_test.php on line 8

Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/html/fileio_test/io_test.php on line 9
Run Code Online (Sandbox Code Playgroud)

如何让apache写入我的主目录?服务器在fedora 20上运行.

php apache

12
推荐指数
2
解决办法
7万
查看次数

如何指向主要的char*argv []?

在c ++中,我有一个主要功能

  int argc, char * argv[]
Run Code Online (Sandbox Code Playgroud)

我需要访问argv[]另一个函数中的数据(即参数).

我将声明一个全局变量,一个指向char **argv.

我该怎么做呢?

c c++ arrays pointers program-entry-point

3
推荐指数
2
解决办法
528
查看次数

在c中使用strlen或malloc之间的区别

有什么区别(1)

char s[5] = {'a', 'b', 'c', 'd', '\0'};
char s2[strlen(s) + 1]; 
strcpy(s2, s);
Run Code Online (Sandbox Code Playgroud)

(2)

char s[5] = {'a', 'b', 'c', 'd', '\0'};
char *s2 = malloc(strlen(s) + 1);
strcpy(s2, s);
Run Code Online (Sandbox Code Playgroud)

在什么情况下你应该使用这些?当您确定阵列s是静态大小时,您是否只能使用第一个?

c arrays

3
推荐指数
1
解决办法
117
查看次数

html img 标签中的正斜杠有什么作用

我正在学习 html/css 并遵循教程 @ W3Schools.com。我遇到问题的代码是@ http://www.w3schools.com/css/tryit.asp?filename=trycss_vertical-align

在第 11 行

<p>An <img src="w3schools_logo.gif" alt="W3Schools" width="270" height="50" /> image with a default alignment.</p> 
Run Code Online (Sandbox Code Playgroud)

/ 在 > 之前和 height 属性之后做什么?我查看了http://www.w3schools.com/tags/tag_img.asp但它没有提到 /。

html css image

1
推荐指数
1
解决办法
5265
查看次数

标签 统计

arrays ×2

c ×2

apache ×1

c++ ×1

css ×1

html ×1

image ×1

php ×1

pointers ×1

program-entry-point ×1