草庐IT

CLASS_EXISTS

全部标签

php - 如何将 $_GET 路径与 file_exists 一起使用并保证其安全?

我有一个函数可以通过jQuery检查文件是否存在,它会调用PHP脚本,我将在单击索引页上的按钮更改某些图像时使用该脚本。jQuery函数:functionfileExists(path){$.getJSON("/ajax/fileExists.php",{path:path},function(data){returndata.path;});}文件存在.php:$path=$_SERVER['DOCUMENT_ROOT'].'/packs'.$_GET['path'];if(file_exists($path)){echojson_encode(TRUE);}else{echojso

php - 警告 : get_class() expects parameter 1 to be object

一周前我写了一个代码,它运行良好。但是今天当我检查它时,它给了我一些问题,比如Warning:get_class()expectsparameter1tobeobject,arraygivenin/home/ccc/public_html/horoscope/xml2json.phponline182Warning:get_class()expectsparameter1tobeobject,stringgivenin/home/ccc/public_html/horoscope/xml2json.phponline182Warning:get_class()expectsparame

php - Laravel 4 PHP fatal error : Class 'Illuminate\Foundation\Testing\TestCase' not found

当我使用Laravel4运行phpunit时出现以下错误。PHPFatalerror:Class'Illuminate\Foundation\Testing\TestCase'notfoundinComposer.json"require":{"laravel/framework":"4.0.*","phpunit/phpunit":"3.7.*"},应用.php'Illuminate\Foundation\Testing\TestCase'我应该做什么? 最佳答案 看起来自动加载不包含新要求。请务必运行composerupdate

php - 错误 : Object of class DateTime could not be converted to string

我在显示值时遇到错误:$thedate=$row2['date'];echo$thedate;在php中,数据库中的值($thedate)是“2015-05-0521:52:31.000”我如何格式化它才能将其作为字符串显示在php页面上?目前它显示错误“DateTime类的对象无法转换为字符串”。 最佳答案 你有一个DateTime对象,所以你必须使用format()格式化你的输出,例如echo$thedate->format("Y-m-d"); 关于php-错误:Objectofcl

php - Prestashop : how to override a module class contained in a file that includes other classes?

prestashop覆盖系统通过使用文件命名方案与许多其他系统一样工作。所以基本上,我将在/overrides/classes中创建一个与/classes中另一个具有相同类和文件名的类,只是为了简化。好吧,我必须覆盖它(使用最新的prestashop版本可以覆盖模块,而以前我们不能):include_once(dirname(__FILE__).'/MailAlert.php');classMailAlertsextendsModule{[....]}我可以用这个覆盖它:classMailAlertsOverrideextendsMailAlerts{[....]}好吧,它有效,文件和

php - Laravel 错误未捕获异常 'ReflectionException',消息为 'Class App\Http\Kernel does not exist'

当我想在我的laravel5.2项目中添加表单时,我在composer中遇到了一些错误。之后我的整个项目都出现了一个奇怪的错误:Fatalerror:Uncaughtexception'ReflectionException'withmessage'ClassApp\Http\Kerneldoesnotexist'inC:\xampp\htdocs\gifkadeh\vendor\laravel\framework\src\Illuminate\Container\Container.php:738Stacktrace:#0C:\xampp\htdocs\gifkadeh\vendor

PHP file_exists 在不存在的文件上返回 true

我有以下代码片段:这应该做的是从配置文件中读取数据,然后使用它连接到MySQL服务器。如果配置文件不存在,它会重定向到一个设置页面,在该页面中创建文件并填充用户提供的数据。问题是,即使文件不存在,file_exists仍然会返回true,这会导致else分支运行并在所有地方失败。我尝试在文件路径中使用$_SERVER['DOCUMENT_ROOT']以防万一;没有区别。 最佳答案 文档:http://php.net/manual/en/function.file-exists.phpReturnsTRUEifthefileordir

PHP array_key_exists key LIKE 字符串,这可能吗?

我已经进行了大量搜索,但无法弄清楚这一点。我有一个这样的数组:$array=array(cat=>0,dog=>1);我有这样一个字符串:Ilikecats.我想查看字符串是否与数组中的任何键匹配。我尝试了以下但显然它不起作用。array_key_exists("Ilikecats",$array)假设我可以在给定时间获得任意随机字符串,我该怎么做呢?伪代码:array_key_exists("Ilikecats",*.$array.*)//Thevalueforcatis"0"请注意,我想检查是否存在任何形式的“猫”。它可以是猫、凯茜,甚至是像vbncatnm这样的随机字母。我正在从

php - 在 Laravel 5.1 中找不到 "Class ' app\Http\Controllers\Controller'

我是Laravel的新手,在学习教程时遇到此错误。这是我在“testController.php”中的代码。这是我的“routes.php”。'test','uses'=>'testController@getHome',]);Route::get('about',['as'=>'about','uses'=>'testController@getAbout',]);我收到这个错误:Class'app\Http\Controllers\Controller'notfound我该如何修复这个错误? 最佳答案 让我们一步一步来。1。检查

PHP CLASS undefined variable (但已定义)

这个问题在这里已经有了答案:"Notice:Undefinedvariable","Notice:Undefinedindex","Warning:Undefinedarraykey",and"Notice:Undefinedoffset"usingPHP(29个答案)关闭5年前。我只是想不通为什么会出现这个错误:Notice:Undefinedvariable:authTimein/.../classname.class.phponline33classClassName{private$authTime=null;constAPI_URL='...';constCLIENT_ID=