小编Tra*_*xys的帖子

PHP无法写入文件

我在CentOS上安装了Apache HTTP服务器,安装了PHP(yum install php),然后测试了一个简单的脚本,该脚本将文本写入文件中,因此我

$file = fopen($filename,"w") or die("Failure"); 
Run Code Online (Sandbox Code Playgroud)

问题是,即使我在该目录中执行了“ a” chown apache:apache /var/www/html/*或“ a” ,它始终都是失败的chmod 777 *,所以有人知道一种了解/解决此问题的方法吗?

编辑:所以这里的问题是目录本身没有chown

php apache centos file

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

重载==编译错误c ++

我做了一个简单的struct命名coord来保持,坐标很好,我想检查两个坐标是否相等,所以我看了如何在另一个线程中做一个正确的运算符重载并想出了这个:

#include <iostream>
using namespace std;

struct coord{
    int x;
    int y;

    inline bool operator==(const coord& lhs, const coord& rhs){
        if(lhs.x == rhs.x && lhs.y == rhs.y){
            return true;
        }
        else{
            return false;
        }
    }
};

int main(){
    coord a,b;
    a.x=5;
    a.y=5;
    b.x=a.x;
    b.y=a.y;
    if(a==b){
        cout<<"Working"<<endl;
    }
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

但在编译时我得到了一个巨大的错误,看起来像:

g++ -c -o obj/main.o main.cpp -I../include
main.cpp:8:62: error: ‘bool coord::operator==(const coord&, const coord&)’ must take exactly one argument
     inline bool operator==(const coord& lhs, const coord& rhs){
                                                          ^ …
Run Code Online (Sandbox Code Playgroud)

c++ overloading operator-overloading

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

标签 统计

apache ×1

c++ ×1

centos ×1

file ×1

operator-overloading ×1

overloading ×1

php ×1