草庐IT

value_variable

全部标签

php - 简单搜索 : Passing Form Variable to URI Using CodeIgniter

我的每个页面上都有一个搜索表单。如果我使用表单助手,它默认为$_POST。我希望搜索词显示在URI中:http://example.com/search/KEYWORD我已经在Google上搜索了大约一个小时,但无济于事。由于nativeURI约定,我只找到了关于如何基本上禁用$_GET的文章。我不可能是第一个想要这种功能的人吧?提前致谢! 最佳答案 如果您要与未启用JS的人打交道,则有更好的解决方法。查看:Controllerinput->post('keyword'));}functionsearch(){//dostuff;}

php - $_POST 作为 $key => $value 使用复选框

我在获取表单来更新从复选框传递的信息时遇到问题。我得到了这个代码。$one=isset($_POST['one'])?'on':'off';只要我分别调用每个复选框,这就很好用。我的问题是我总共有大约200个复选框。这是我用来UPDATE的代码。任何人都可以帮我弄清楚在哪里将我得到的代码插入到我现在的代码中吗?我尝试了各种变体。if($_POST['submit']){if(!empty($applicant_id)){$sql="UPDATEplaySET";foreach($_POSTas$key=>$value){if(($key!='submit')&&($key!='appl

php - 面向对象设计 : Return Values or Set Property?

在这种情况下,什么将被视为“最佳实践”。我有一个正在收集远程资源的类,它看起来有点像这样:classGather{publicfunctiongetAll($locations){$results=array('All','My','Results');return$results;}}我的问题是,返回结果或将它们分配为属性是否被视为最佳做法?即。//This$results=$gatherer->getAll();//vsThis$gatherer->getAll();//now$gatherer->resultscanbeused这很可能是我想多了,但我没有接受过正规培训,我想知道

php - 如果我在 $_variable ['variable' ] 中省略单引号会有什么不同吗?

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:Accessingarrayswhitoutquotingthekey我注意到有一个细微的差别......如果我要这样编码:echo"Welcome,$_SESSION['username'],youareloggedin.";它会在解析时失败。但是,如果我这样编码:echo"Welcome,$_SESSION[username],youareloggedin.";它按预期工作,这让我想知道是否真的需要单引号?我在PHP文档中找不到任何显示该效果的内容。

PHP 不会对 undefined variable 发出警告

如有错误请指正。据我所知,PHP应该对此发出警告,但实际上没有。我正在使用PHP5.2.17。我怎样才能解决这个问题?我假设这是在php.ini中的某处设置的? 最佳答案 查看errorreporting的文档.我相信如果您启用E_NOTICE,您会看到针对undefinedvariable的警告。您可以阅读所有错误报告常量here. 关于PHP不会对undefinedvariable发出警告,我们在StackOverflow上找到一个类似的问题: https

php - 烦人的 PHP 错误 : "Strict Standards: Only variables should be passed by reference in"

我制作了这个小脚本,但我无法得到这个错误:严格的标准:只有变量应该在C:\xampp\htdocs\includes\class.IncludeFile.php中第34行通过引用传递!这是页面:namespaceCustoMS;if(!defined('BASE')){exit;}classIncludeFile{private$file;private$rule;function__Construct($file){$this->file=$file;$ext=$this->Extention();switch($ext){case'js':$this->rule='file.'">

php - .sprintf ("%4.2f", value) 如何在 PHP 中运行?

我正在学习更多PHP教程,特别是DevZonePHP101,并感到困惑:echo.sprintf("%4.2f",(2*$radius*pi()))我找到了这个Ithinkthatmeansproduceafloating-pointfieldfourpositionswidewithtwodecimalplaces,usingthevalueofthefirstsucceedingparameter.ThatcomesfromtheC/C++lineofprogramminglanguages.ansprintf()takesthefirstparameterasaformatsta

php - 为什么我在 Laravel View 中得到 "Undefined variable"?

当我尝试从类别所在的表中获取数据时,出现undefinedvariable:类别错误。$posts变量工作正常。@if(count($posts))@foreach($postsas$post)@if($post->category)category->name}}isotope-item">{{$post->updated_at}}{{Str::words($post->title,3)}}{{Str::words($post->body,60)}}{{HTML::linkRoute('posts.show','Readmore',array($post->id))}}@endif@

php - codeigniter 上的错误 undefined variable 替代

我在我的View文件中发现了这种错误类型,如下所示。请帮我解决这个错误。我很高兴能解决这个问题。我在等待正确答案遇到PHP错误严重性:通知消息:undefinedvariable:备选文件名:views/all_investor_relation.php行号:47$value){$paths=base_url().'uploads/investor_relation/';$image=$value['docpath'];$title=$value['title'];$imageso="$title";$content="".$i."".$imageso."}echo$content;}

php - 组合两个数组值,使它们成为 key=>value 格式

这个问题在这里已经有了答案:Howtocombinetwoarraystogether?(3个答案)关闭6年前。我有两个这样的数组Array([0]=>username[1]=>avatar)Array([0]=>name[1]=>4.jpg)在这里,我需要按照以下格式获取这些值'用户名'=>姓名,'头像'=>4.jpg即,以上述格式合并相同的键值..我应该怎么做,..有人帮助我..如果您认为我的标题有误,请修改为正确的格式。谢谢,