草庐IT

外参数

全部标签

php - 如何测试 PHP 按位函数输入参数

有时在编程中,它们允许将参数链接到单个函数输入变量中,例如下面的第二个输入变量:define('FLAGA',40);define('FLAGB',10);define('FLAGC',3);functionfoo($sFile,$vFlags){//dosomething}foo('test.txt',FLAGA|FLAGB|FLAGC);PHP将这个单竖线字符(|)称为按位OR运算符。我现在如何在foo()中添加一些东西来测试$vFlags以查看设置了哪些标志? 最佳答案 我想你会发现像这样的标志通常被定义为2的幂,例如:def

php - Laravel 验证 ErrorException - htmlentities() 期望参数 1 为字符串,数组给定

所以我是laravel5的新手,刚开始编写我自己的应用程序。当我只是调用invoices.createController的路由时,View生成得很好。当我从invoices.storeController重定向到同一View时,我收到以下错误消息。我的Controller,看起来像这样。我猜它与传递给Controller​​的参数冲突,查看消息。但我似乎找不到问题所在以及解决方法。编辑:这是View...@extends('app')@section('content')NewInvoice@if($errors->has())@foreach($errors->all()as$er

php - Yii2 url路由获取字符串参数

我有这样一个网址http://localhost/yii2/category/my-custom-string-parameter我需要获取文本my-custom-string-parameter我这样设置规则'urlManager'=>['class'=>'yii\web\UrlManager','showScriptName'=>false,'enablePrettyUrl'=>true,'rules'=>array('/'=>'/view','//'=>'/','/'=>'/','category/'=>'category/view',),],这总是给我404错误。我该怎么办?

php - 使用带有多个参数的 yii\rest\UrlRule 的 Yii2 路由

我正在尝试为RESTAPI使用Yii2路由。以下教程位于http://www.yiiframework.com/doc-2.0/guide-rest-routing.html,我已经(成功地)为API入口点定义了很多规则,如下所示:'urlManager'=>['enablePrettyUrl'=>true,'enableStrictParsing'=>true,'showScriptName'=>false,'rules'=>[['class'=>'yii\rest\UrlRule','controller'=>'user'],],]这样的规则定义:GET/users(列出用户)GE

php - 从中间件访问路由前缀中的 URL 参数

我正在努力从我的中间件访问路由前缀参数。给定此URL:http://www.example.com/api/v1/campaign/40/status,以及以下路由:Route::group(['prefix'=>'api/v1'],function(){Route::group(['prefix'=>'campaign/{campaign}','where'=>['campaign'=>'[0-9]+'],'middleware'=>['inject_campaign']],function(){Route::get('status','CampaignController@getS

php - Laravel 5 - Controller 中的路由和可变参数

我想在搜索时生成这样的SEO友好URL:http://www.example.com/search(无过滤器)http://**www.example.com/search/region-filterhttp://**www.example.com/search/region-filter/city-filter并以这种方式对它们进行分页:http://www.example.com/search/2(无过滤器,第2页)http://**www.example.com/search/region-filter/2http://**www.example.com/search/regio

php - 提取内容中的简码参数 - Wordpress

考虑如下帖子内容:[shortcodea="a_param"]...Somecontentandshortcodeshere[shortcodeb="b_param"]..Againsomecontenthere[shortcodec="c_param"]我有一个带有3个或更多参数的简码。我想知道短代码在内容及其参数中使用了多少次,例如,array([0]=>array(a=>a_param,b=>null,c=>null),[1]=>array(a=>null,b=>b_param,c=>null),[2]=>array(a=>null,b=>null,c=>c_param),)我需

php - URL 不接受字母数字参数 - Yii2-app-basic

很快,我将在URL中传递41。confirm.php打印41。http://localhost/yii2-app-basic/web/site/confirm/41但是,当我在URL中传递“cfeb70c4c627167ee56d6e09b591a3ee”或“41a”时,http://localhost/yii2-app-basic/web/site/confirm/41a显示错误NOTFOUND(#404)Pagenotfound.TheaboveerroroccurredwhiletheWebserverwasprocessingyourrequest.Pleasecontactu

PHP LDAPS 提供的参数不是有效的 ldap 链接资源

我正在尝试从Windows机器上的本地UbuntuVMBox连接到远程LDAP服务器。PHP代码是:$ldap=ldap_connect("ldaps://11.22.33.44",636);ldap_set_option($ldap,LDAP_OPT_REFERRALS,0);ldap_set_option($ldap,LDAP_OPT_PROTOCOL_VERSION,3);$username="domain\usr";$password="blah";$ds=ldap_bind($ldap,$username,$password);if($ds){echo"loggedin!";

php - 使用不同的参数处理 .htaccess 重定向?

我想将不进入目录的url重定向到一个脚本(例如script1.php),并将具有类别的url重定向到另一个脚本(script2.php)。基本上我想做这样的事情:http://www.test.com/user1->http://www.test.com/script1.php?username=user1其中script1.php获取用户名并为该用户提供适当的页面。我有那个部分使用这段代码:RewriteCond%{REQUEST_FILENAME}!-fRewriteCond%{REQUEST_FILENAME}!-dRewriteRule^(.*)$script1.php?use