草庐IT

get_level_values

全部标签

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 - CodeIgniter get_where()与NOT IN

我正在尝试执行一个select语句,该语句将显示与当前文章相关的文章,但将当前文章从选择中排除。选择的前提是它将从当前帖子的类别中选择6个帖子,不包括传递permalink变量的任何帖子。代码:$query=$this->db->get_where('chanl_posts',array('category'=>$category),NOTINarray('permalink'=>$permalink),6);这是我试图不起作用的,并且DOCS声明有一个GETXONEXNOTION()方法,但是这会允许我将类别子句应用到它吗? 最佳答案

javascript - 单击时将 GET 参数注入(inject)按钮的目标 URL

我有多个类为myButton的按钮。每个按钮都有一个值,该值在单击时发送到服务器。按钮的目标URL看起来像这样:http://mysite/test/test.html?cid=15在我点击按钮后,应该将以下GET参数添加到URL,然后应该提交按钮:mySessionVar=1所以新的URL应该是这样的:http://mysite/test/test.html?cHash=d009eb3f9f4e1020435b96a8f7251ad5&mySessionVar=1为什么我要注入(inject)它?我正在使用流体。据我所知,不可能使用JavaScript操作流体标签。但是,我需要将se

php - 在 Slim Framework v3 中访问多个 GET 参数

我有一个将重定向到的脚本代码http://localhost:8080/generated/sample/+$('form.wpcf7-form').serialize();一个示例生成的url是http://localhost:8080/generated/sample/_wpcf7=222&_wpcf7_version=4.5.1&_wpcf7_locale=en_US&_wpcf7_unit_tag=wpcf7-f222-p37-o1&_wpnonce=35162dc550&your-name=Robert+Soriano&your-email=sorianorobertc%40

php - array_count_values 我想回显一个特定的键值

我忙于一家网上商店,我想回复一下今天有多少订单需要交付我有一个循环,其中包含以下代码:$winkels[]=$vendor->id;这很好,因为我做了以下代码:echo''.print_r(array_count_values($winkels),true).'';比我得到的结果:Array([63]=>1[45]=>1[85]=>1[59]=>1)结果很好,但是我怎么能回显id:63的值呢?有人能帮帮我吗? 最佳答案 对于单例:-$data=array_count_values($winkels);echo$data[63];对于

php - 我如何使 $_GET 更安全。?

我正在使用get方法为评论系统执行一些操作,如批准、标记垃圾邮件、删除。我知道走这条路很不安全,但我无能为力。因为使用$_GET方法的原因是使用PHP_SELF在页面本身内执行操作,仅供引用,我也使用使用复选框的post方法来执行操作。现在为了让它有点安全,我想随机化数字或生成哈希或其他东西,然后比较它,获取id并执行操作我现在的代码有点像这样。">Unapprove">Approve|">Spam|">Edit|">Delete然后我使用这段代码执行操作..if(isset($_GET['approve'])){$id=intval($_GET['approve']);$query=

arrays - "Can' t use function return value in write context”PHP错误

Fatalerror:Can'tusefunctionreturnvalueinwritecontextinline3,在什么情况下会触发此类错误?我的程序://QUERYVARIABLE$query="select*formuserwhereuser_name='$user_name'anduser_password='sha($user_password)'";//ESTABLISHINGCONNECTION$result=mysqli_query($dbc,$query)ordie('ErrorQueryingDatabase');while($row=mysqli_num_ro

php - 如何在代理后面使用 file_get_contents()?

当我们使用file_get_contents时,PHP用什么来解析域名(本地DNS??)。我问是因为我遇到了这个错误:Warning:file_get_contents(http://external-domain.com)[function.file-get-contents]:failedtoopenstream:Aconnectionattemptfailedbecausetheconnectedpartydidnotproperlyrespondafteraperiodoftime,orestablishedconnectionfailedbecauseconnectedhos

php - in_array 组合值 ('test' ,'value' )

我正在尝试将in_array或类似的东西用于关联数组或更复杂的数组。这是普通的in_arrayin_array('test',array('test','exists'));//truein_array('test',array('not','exists'));//false我要搜索的是对,例如“test”和“value”的组合。我可以根据需要将要搜索的组合设置为array('test','value')或'test'=>'value'。但是,如果要搜索的数组是,我该如何进行搜索?array('test'=>'value','exists'=>'here');orarray(arra

php - 使用 get_meta_tags() 和 get_headers() 进行异常处理?

在PHP中,我使用get_meta_tags()和get_headers(),但是,当出现404时,这两个函数会抛出警告。我有什么办法可以捕获它吗?谢谢! 最佳答案 get_headers不会在404上抛出警告/错误,但get_meta_tags会。所以你可以检查标题响应并在它不正常时做一些事情:$url='http://www.example.com/';$headers=array();$metatags=array();$validhost=filter_var(gethostbyname(parse_url($url,PHP