草庐IT

set_index

全部标签

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 - 拉维尔 : is it possible to set a controller dynamically for a route?

那么,假设我有一个简单的Controller来处理书籍。App\Http\Controllers\SimpleBooksController在routes.php中,我为它注册了一个路由:Route::get('books/{id}','SimpleBooksController@doSimpleStuff');但是书的世界并没有那么简单。所以我想要另一个Controller来处理真正复杂的书籍内容。在我的脑海里,我想象这样的东西会非常有用:classComplexBooksControllerextendsSimpleBooksController以便子类未明确处理的路由回退到父类。

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 - Symfony2 : set default value from database in radio buttons choice form?

symfony2的新手,我有一个包含2个字段的简单表格。由于alert字段是一个bool值,我声明了这样的表单:publicfunctionbuildForm(FormBuilderInterface$builder,array$options){$builder->add('message','text',array('label'=>"Message"))->add('alert','choice',array('choices'=>array(1=>'Yes',0=>'No'),'expanded'=>true,'multiple'=>false,'label'=>"Areyou

php - Yii2 无效调用 : Setting read-only property

我有一个Post模型,它与Tags有很多对多的关系。在Post模型中定义:publicfunctiongetTags(){return$this->hasMany(Tags::className(),['id'=>'tag_id'])->viaTable('post_tags',['post_id'=>'id']);}但是Post::tags是只读的。因此,当我尝试在Controller中设置它们时,出现错误:InvalidCall–yii\base\InvalidCallExceptionSettingread-onlyproperty:app\models\Post::tagsCo

PHP ini_set 内存限制

当我们在代码中像下面这样使用ini_set时,所有其他代码的内存限制是否相同?或者只对我们添加的代码有效?ini_set('memory_limit','512M');谢谢 最佳答案 它只对写入它的文件有效。更改同一文件夹中多个php设置的最佳方法是:1。使用以下行创建名为“.htaccess”的文件php_valuememory_limit'512M'请记住,这仅在您的服务器配置允许此目录的“AllowOverride”指令时有效2。使用您的配置选项添加自己的php作为auto-prepend-file您可以在php.ini中执行

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

PHP 将 url 传递给 index.php

这应该非常简单,但我希望能够像php框架那样将url用作变量。mywebsite.com/hello-world我希望我的index.php将“hello-world”视为一个变量,并且我希望加载index.php。这是通过php完成的还是我必须使用htaccess文件?许多php框架使用url向索引文件发送消息...例如...mysite.com/controller/view我自己如何通过php路由它们?一点帮助? 最佳答案 有两个步骤:使用.htaccess文件重写url(在linux上)。您需要确保所有请求都转到您的php文

php - CakePHP 3 : Changing structure of result set

我是CakePHP新手,遇到以下问题:我有表“图片”、“关键字”和“关键字类别”。每个图像都可以有多个关键字(多对多),每个关键字都有一个类别(多对一)。使用检索图像列表$images=$this->Images->find()->contain(['Keywords','Keywords.KeywordCategories']);返回这样的结果结构:[{"id":1,"keywords":[{"keyword":"Dog","keyword_category":{"title":"Animal"}},{"keyword":"Cat","keyword_category":{"titl