首页 > 编程知识 正文

解决php中cannot(php问题)

时间:2023-12-24 12:05:45 阅读:320882 作者:HFHR

本文目录一览:

PHP报错:: Cannot access protected property

声明为protected、private的变量,只能在类的内部实现中使用。而类的实例(对象)无法直接访问这些变量,会产生致命错误。你没有正确理解这个概念。

私有变量的访问参见下例:

?php

class Cls {

    private $_foo = null;

    public function setFoo($value) {

        $this-_foo = $value;

    }

}

望采纳,谢谢支持!

跪求大神解决PHP环境配置中,修改Apache遇到的问题: Cannot load php5apache2_2.dll into server

既然提示404估计你的设定的路径有些问题,我说的是你服务器根目录设定可能有问题,也可能是其他的,如果你刚开始学习PHP,个人建议先别在环境配置这里死磕,推荐你一些方便好用的集成环境:

appserver;

phpstudy;

wamp;

xampp;

都可以百度下载的

运行php网页出现Fatal error: Cannot access empty property 这怎么解决呢?

翻译过来的意思是,不能访问空属性

我对php不熟

应该是在php中定义了类,又在类中定义了属性,但可惜这个属性是空的,没有被赋值,而你又要去访问它,就出错了

php菜鸟路过··

忘采纳

清除一下bom头再试一下。bom清除函数

[code]

?php

//remove the utf-8 boms

//by magicbug at gmail dot com

if (isset($_GET['dir'])){ //config the basedir

$basedir=$_GET['dir'];

}else{

$basedir = '.';

}

$auto = 1;

checkdir($basedir);

function checkdir($basedir){

if ($dh = opendir($basedir)) {

while (($file = readdir($dh)) !== false) {

if ($file != '.' $file != '..'){

if (!is_dir($basedir."/".$file)) {

echo "filename: $basedir/$file ".checkBOM("$basedir/$file")." br";

}else{

$dirname = $basedir."/".$file;

checkdir($dirname);

}

}

}

closedir($dh);

}

}

function checkBOM ($filename) {

global $auto;

$contents = file_get_contents($filename);

$charset[1] = substr($contents, 0, 1);

$charset[2] = substr($contents, 1, 1);

$charset[3] = substr($contents, 2, 1);

if (ord($charset[1]) == 239 ord($charset[2]) == 187 ord($charset[3]) == 191) {

if ($auto == 1) {

$rest = substr($contents, 3);

rewrite ($filename, $rest);

return ("font color=redBOM found, automatically removed./font");

} else {

return ("font color=redBOM found./font");

}

}

else return ("BOM Not Found.");

}

function rewrite ($filename, $data) {

$filenum = fopen($filename, "w");

flock($filenum, LOCK_EX);

fwrite($filenum, $data);

fclose($filenum);

}

?

[/code]

PHP制作验证码 显示Cannot redeclare一下就是代码 求帮助。。。

这个函数这样写没有问题,你检查一下你的GD库安装了没有,还有看看php的版本,有可能是gd扩展和php版本的问题。你还可以检查一下你这个文件是不是有重复冲突的一些名字。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。