草庐IT

MY_VARIABLE

全部标签

php - Htaccess : How to get Variable form URL?

我有一个关于htaccess的问题。我正在尝试执行以下操作:blabla.com/lala和blabla.com/lululala和lulu是我的变量(在两个站点上显示不同的内容,但它是同一个文件(example.php)。所以我在htaccess中所做的是:RewriteRule^([^&]+)$example.php?type=$1但是当回应GET[type]时,我只得到文件名(“example.php”)。但我希望它显示“lala”或“lulu”。当我这样做时它会起作用:RewriteRule^blablabla/([^&]+)$example.php?type=$1但我只是不需

php - 强制下载脚本和读取文件 : Why readfile outputs my html page?

我正在尝试为webroot以外的用户发送文件(附件)。我制作了强制下载脚本,它在header中发送文件并在流中输出。这很好用,直到我调用readfile(也可以是标题设置),它输出一个文件,其中包含我的html源代码的一半(该特定页面的)。我做了file_get_contents()并且文件包含正确的字符串:“test”。这里有什么问题?$file名为test.txt并包含字符串“test”。Mime/content-type是正确的。但是这个脚本的输出是html源。 最佳答案 来自readfile文档,他们在readfile之前进

undefined variable 的 php 通知 & 试图获取非对象的属性

我通过Joomla项目学习和执行php如何改进此代码并解决PHP通知-任何建议-解决方案-非常感谢!!注意:undefinedvariable:condin*/home/mygames/public_html/components/com_toys/models/category.php第140行(这是$sql行)*functionloadSubCat($id,$Carmodel,$minprice,$maxprice){$mainframe=&JFactory::getApplication();$option=JRequest::getCmd('option');$database

PHP : session variable having an undefined offset error

我是PHP编程的新手。我正在创建一个带有session的简单登录表单。我传递了两个session变量:$_SESSION['username']和$_SESSION['logon'].这是我的代码:$rowcount=mysqli_num_rows($result);if($rowcount==1){session_start();$_SESSION['logon']=="online";$_SESSION['username']=$username;header("location:../index.php?username=$_SESSION[username]");}问题是,当我

php - 微软 VS 代码 : When I try to launch my program error "spawn php ENOENT" shows up

我正在尝试在MicrosoftVSCode上运行PHP代码。当我单击启动时,唯一发生的事情是调试控制台中出现错误:spawnphpENOENT为了解决这个问题,我将XDebug的dll文件放到了ext文件夹中。我将php.ini-development复制到一个名为php.ini的新文件中,并在该文件中将其添加到文件末尾。zend_extension="[filepath]"xdebug.remote_enable=1xdebug.remote_autostart=1这没有任何改变。然后,我为我的防火墙添加了入站规则以允许端口9000上的入站连接。仍然没有任何改变。我该如何解决这个问题

PHP 获取 "Undefined Variable and "空属性“代码错误

这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:PHP:“Notice:Undefinedvariable”and“Notice:Undefinedindex”我已将此错误减少到最少的代码量,而且它是如此之少,以至于我在这里真的感到很愚蠢。我有2个文件class1.php:1thisisatestparagraph';5protected$bigHeader='header1';6protected$textArray;78publicfunction__construct(){9$this->$textArray=array($this->$bigHea

PHP - 正确检查 $_POST ['variable' ] 是否已发布

我想检查$_POST['submit']是否已发布。我的原始代码是:if($_POST['submit']){}但是我有一个带有此代码的PHP通知-“undefinedindex:提交...”所以要删除通知,我必须这样写:if(isset($_POST['submit'])){}但这毫无意义,因为$_POST数组是全局的,它总是返回true。另外,如果我想在没有PHP通知的情况下检查$_POST['submit']是否不为0,我必须这样写:if(isset($_POST['submit'])&&$_POST['submit']!=0){}在这种特殊情况下,我更喜欢:if($_POST[

php - 拉维尔 5.2 : How to get a variable in a subView of a parentView from another subView?

下面是我的View和Controller,我希望$name变量可以在包含在主视图中的导航栏View中访问。有人知道解决方案吗?userController.phppublicfunctionindex($var){$u_array=$var;$name=$u_array->name;returnview('index',compact(name));}ma​​ster.blade.php@include('navbar')@yield('content')index.blade.php@extends('master')@section('content'){{$name}}@ends

php - Laravel: Blade View 中的 undefined variable

这是AdminController.php:$images]);}}这是admin.blade.php:@extends('template')@section('title')AdminPage@endsection@section('header')@endsection@section('main')@if(Auth::check())@foreach($imagesas$image)id}}'>{{$image->content}}id}}/delete"method="post">Deletecaptionid}}/approve"method="post">Acceptim

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=