草庐IT

Function-Index

全部标签

php - 如何让 NGINX 通过 index.php 执行文件夹中的所有 URL

我为此搜索了很多答案,但找不到合适的答案。基本上,我有一个在NGINX上运行的SilverStripe构建的站点。一切正常,但我希望通过站点根目录中的index.php解析通过管理员(到Assets文件夹)上传的任何文件/图像(这样我们可以在返回之前检查管理员中设置的文件的权限给用户)。我有一个非常简单的nginx配置(用于我的本地docker实例):server{includemime.types;default_typeapplication/octet-stream;client_max_body_size0;listen80;root/var/www/html;location

php - 从 codeigniter url 中删除 index.php

我是codeigniter的新手。我在localhost/path/learn_ci安装了我的codeigniter。我已遵循codeigniterwiki中给出的所有步骤。这是我的.htaccess文件。RewriteEngineOnRewriteCond%{REQUEST_FILENAME}!-fRewriteCond%{REQUEST_FILENAME}!-dRewriteRule^(.*)$/learn_ci/index.php/$1[L]ErrorDocument404/index.php我还根据需要更改了配置文件。但是当我尝试访问我得到这个错误"TherequestedUR

PhpUnit 模拟 : function undefined

我正在为我的View助手编写一些测试。这是我第一次想用模拟对象做点什么。我正在使用默认的PHPUnit模拟框架。我已经编写了一个函数来准备我的模拟对象:privatefunctiongetTestStub(){$mockResult=array();$mock=$this->getMock('My\Entity\Product');$mock->expects($this->once())->method('getId')->will($this->returnValue(1));$mock->expects($this->once())->method('getName')->wil

php - 无法使用 vagrant 和 virtualbox 使用 apache 加载 index.php 页面

这是我的vagrantfile:#-*-mode:ruby-*-#vi:setft=ruby:Vagrant.configure("2")do|config|#AllVagrantconfigurationisdonehere.Themostcommonconfiguration#optionsaredocumentedandcommentedbelow.Foracompletereference,#pleaseseetheonlinedocumentationatvagrantup.com.#EveryVagrantvirtualenvironmentrequiresaboxtobu

php - register_shutdown_function 将引用转换为值?

我正在尝试使用一个关闭函数,该函数使用注册后动态更改的值。我的理解是,通过引用传递变量将允许代码后面部分的更改影响关闭调用。下面的代码证明情况并非如此:我是不是误解了应该怎么做?将引用传递转换为值传递是注册函数的预期行为吗?PHP版本5.5.9 最佳答案 一种可能的解决方案是使用匿名函数(在本例中是一个闭包,捕获了$x作为引用):$x=0;$shutdown=function()use(&$x){echo$x;};register_shutdown_function($shutdown);$x=1;exit();演示:http://

php - 您可以在 index.php - Fat Free Framework 中使用配置文件中的全局变量吗?

我想在我的config.ini文件中设置一个名为CONTROLLERPATH的全局变量,然后在我的index.php文件中使用该变量将GET请求路由到我的目录结构中的正确Controller。我正在执行以下操作,但F3无法确定CONTROLLERPATH的值。我的config.ini文件:[global]DEBUG=3UI=ui/CONTROLLERPATH='app/controllers/'在我的index.php文件中:$f3->config('config.ini');$f3->route('GET/',CONTROLLERPATH.'indexController->inde

php - 由于 index.php 导致 Codeigniter 500 内部服务器错误

我正在使用codeigniter框架,当我将它上传到主机时,它给了我一个500内部错误。但是当我将index.php添加到config.php时,它起作用了。我该怎么办?在我的.htaccess中我有这个:RewriteEngineOnRewriteBase/ci-framework/而且,当我从RewriteBase的末尾清理/ci-framework/时,它也不起作用。非常感谢。 最佳答案 您不需要在config.php文件中添加index.php。确保您在.htaccess文件中有以下行:RewriteEngineOnRewr

php - 我在使用 Index.php 加载主页时收到 404,但 index.php 在直接链接上工作,为什么?

我似乎无法理解为什么我的Homepage突然拒绝直接加载,即:www.mysite.com/但加载仅当您键入www.mysite.com/index.php时这是网站:比较:http://www.propasiarealty.com//Sendsyoutothe404page鉴于:http://www.propasiarealty.com/index.php//Loadsthehomepage.无法弄清楚到底哪里出了问题,请帮忙。下面是Filezilla的截图:编辑01请看我的HTACCESS...快照更新02我修改了HTACCESS还是没有成功,现在看起来是这样的:Directory

PHP_SELF 返回/index.php/index.php

为什么$_SERVER['PHP_SELF']返回/index.php/index.php??请求http://example.com输出/index.php/index.php索引.phpnginx.confserver{listen80;server_namedomain.com;root/var/www/public/www;#Addtrailingslashrewrite^([^.\?]*[^/])$$1/permanent;location/{try_files$uri$uri//index.php?$query_string;}location~\.php${include

c# - C# 中的 PHP function_exists/class_exists 等价物

我正在asp.net/c#中寻找这两个函数的替代方法。if(function_exists('foo')){$returned=foo($bar);}if(class_exists('foo')){$fooclass=newfoo($bar);} 最佳答案 Assemblyassembly=Assembly.LoadFile("assemblyAddress");boolcontainClass=assembly.GetTypes().Where(x=>x.Name=="ClassName").Count()>0;boolconta