草庐IT

optional-parameters

全部标签

php - X-Frame-Options : does not permit cross-origin framing 拒绝加载

我正在使用laravel4进行我的开发之一,我正在尝试使用跨源调用加载iframe。但它会抛出一个错误,如“X-Frame-Options拒绝加载:不允许跨源框架”。我正在尝试设置标题,例如:header('X-Frame-Options:ALLOW-FROMSAMEORIGIN');header('X-Frame-Options:ALLOW-FROMGOFORIT');但我仍然遇到上述问题。如果我遗漏了什么,请提出建议。 最佳答案 当您使用ALLOW-FROM时您必须指定一个URL,而不是替代值。使用SAMEORIGIN明确阻止跨

php - 使用 cURL 发布数据时出现 "Positional Parameter"错误

如果我在没有--data"..."的情况下发出命令,它会工作得很好。我试过谷歌,但找不到这个问题的任何答案。按照位于here的指示进行操作当我尝试使用cURL发布数据时出现以下错误:PSC:\Users\David>curl--data"SMethod=0""http://localhost/terra/modules/scripts/Query.php"Invoke-WebRequest:Apositionalparametercannotbefoundthatacceptsargument'SMethod=0'.Atline:1char:1+curl--data"SMethod=0

php - openssl_pkey_export 和 "cannot get key from parameter 1"

我需要在我的php项目中使用openssl,所以我使用openssl创建了一个测试php页面。但是,我不断收到这些错误,我不确定为什么。openssl已启用。Warning:openssl_pkey_export()[function.openssl-pkey-export]:cannotgetkeyfromparameter1inC:\wamp\www\opensslsample\index.phponline18Warning:openssl_pkey_get_details()expectsparameter1toberesource,booleangiveninC:\wamp\

php - 处理 PHP 和 HTML <option> 逻辑的更好解决方案

想知道您是否可以向我展示一种处理此逻辑的更好方法?我写了这篇文章,对此感到非常羞愧。你能告诉我这个逻辑的更好优化版本吗?P.S$result["item"];返回一个整数。$type=$result["item"];switch($type){case"1":$type_output='CashChequeDebitCardCreditCard';break;case"2":$type_output='CashChequeDebitCardCreditCard';break;case"3":$type_output='CashChequeDebitCardCreditCard';bre

php - WP - 高级自定义字段 : acf_add_options_page() does not exist

我正在尝试在WP中使用高级自定义字段设置选项页面。functions.php文件中的内容:if(function_exists('acf_add_options_page')){acf_add_options_page();acf_add_options_sub_page('General');acf_add_options_sub_page('Header');acf_add_options_sub_page('Footer');}问题是function_exists('acf_add_options_page')返回false。好像没有这个功能,不过我用的是最新版的ACF。当我尝试

php - 给出警告 : number_format() expects parameter 1 to be double, 字符串

关闭。这个问题需要debuggingdetails.它目前不接受答案。编辑问题以包含desiredbehavior,aspecificproblemorerror,andtheshortestcodenecessarytoreproducetheproblem.这将有助于其他人回答问题。关闭7年前。Improvethisquestion我的页面slider出现此错误:Warning:number_format()expectsparameter1tobedouble,stringgivenin/home/globalar/public_html/wp-content/themes/au

PHP 和 ZIP 创建 : Can standard zip "options" be applied

有人知道在创建zip文件时如何使用PHPZIP函数来应用标准zip“选项”吗?到目前为止,我所有的搜索都没有找到任何结果。特别是我对应用“-ll”和“-l”选项感兴趣,因此我可以提供WIN或NIX版本的压缩文本文件(cgi和php以及文本文件等)来自nix网站。内容将即时压缩,并为每个特定客户编辑添加的一些文件。我知道构建和使用命令行“反勾号”(Perl)或“passthru(.)”(php)方法,但我希望有使用纯PHP的技巧,即ZipArchive()。问候。 最佳答案 您可能最终会退回到shell_exec并只使用native系

php - stream_context_set_params 与 stream_context_set_option

文档怎么说通过阅读php.net,在我看来,stream_context_set_params几乎与stream_context_set_option做同样的事情。即。http://www.php.net/manual/en/function.stream-context-set-params.phpboolstream_context_set_params(resource$stream_or_context,array$params)http://www.php.net/manual/en/function.stream-context-set-option.phpboolstre

php - 奇怪的 PHP 错误 : function not recognizing its own parameter

我有以下功能:publicfunctionupdateCustomerInternetBanking($value,$column_to_go_by){$sql="UPDATEcustomercJOINaccount_importaiONc.account_import_id=ai.idJOINgeneric_importgiONai.generic_import_id=gi.idJOINimport_bundleibONgi.import_bundle_id=ib.idSEThas_internet_banking=1WHEREc.".$column_to_go_by."=".$th

php - 初学者 : Limit URL parameter by using regular expression

我需要一些关于正则表达式的帮助来限制用户为输入传递糟糕的参数时的选择。例如路径是这样的:/project/create/:category(:category是参数的占位符,因此我可以在我的Controller中访问它)基本上我想要做的是将URL与该类别的2个选项(报价|请求)之一相匹配。这使得用户尝试执行404重定向的任何其他路径都能正常工作。只允许这些选择的正则表达式需要是什么?(提供|请求)'/\/component\/create\/(offer|request)/'-会成功吗?提前致谢 最佳答案 从您表达问题的方式来看,您