草庐IT

domain_exists

全部标签

php - 与 Symfony2 AsseticBundle 和 'non existing routes' 冲突

Assetic不适用于此标签:{%stylesheetsoutput='/style/app.css''@VendorBundle/Resources/style/main.css'%}{%endstylesheets%}如果我使用它,就像Assetic不知道如何处理它一样。在config_devuse_controller中为真。我找不到我做错了什么。我刚明白:Anexceptionhasbeenthrownduringtherenderingofatemplate("UnabletogenerateaURLforthenamedroute"_assetic_aca6c7a_0"as

php - "Request does not exist"创建表单 symfony2

我是php和symfony2的菜鸟。我正尝试按照教程http://symfony.com/doc/current/book/forms.html创建一个表单和其他一些教程。我收到“500内部错误”,我不知道我什么时候失败了,我正在伤脑筋。需要帮助,请日志:[2015-10-1623:35:27]request.INFO:Matchedroute"nueva_serie".{"route_parameters":{"_controller":"Acme\\AxialBundle\\Controller\\SeriesController::nuevaAction","_route":"n

php,realpath 与 realpath + file_exists 用法

出于性能原因,我们应该只使用realpath()而不是realpath()+file_exists()在检查文件或目录是否存在时??案例A::if(realpath(__DIR__."/../file.php")===false)案例B::if(file_exists(realpath(__DIR__."/../file.php"))===false)我认为CASEA完成了工作,而CASEB完成了两次工作。 最佳答案 不仅情况B是多余的(因为根据docs,如果路径无法解析或文件不存在,则realpath返回false),如果文件不存

php - .htaccess 重写规则 : two domains using same server and directory

作为背景知识,我们有两个域:mydomain.commydomain.czmydomain.cz指向mydomain.com的服务器并使用相同的目录。我们在.htaccess(两个域共享)中有一个RewriteRule,如下所示:RewriteRule^([0-9]+)/?$project.php?id=$1[NC,L]#HandleprojectrequestsRewriteRule^([0-9]+)/?$project_cz.php?id=$1[NC,L]#Handleprojectrequests此RewriteRule在使用来自mydomain.com/project.php?

php - apc_exist() 不存在?

我很难让PHPAPC工作。这是我的测试代码:CACHEINFO(USER):CACHEINFO:FOO:BAR:barexists!bardoesnotexist!简而言之:您填写表格,插入的值存储在APC中。始终存储key“foo”。您可以尝试存储“bar”以查看apc_fetch()使用新添加的key。什么工作正常:apc_store()apc_fetch()什么不是:apc_cache_info()(无论我将哪些参数传递给函数)总是打印一个空数组,尽管apc_fetch()成功检索数据apc_clear_cache()从不清除缓存(“bar”总是在输入后显示)。如果我提供一个"u

php - mkdir 函数抛出异常 'File exists' 即使在检查该目录不存在之后

我偶然发现了PHP中mkdir函数的每一个奇怪行为。下面是我的简单代码示例。$filepath='/media/static/css/common.css';if(!file_exists(dirname($filepath))){mkdir(dirname($filepath),0777,TRUE);}“媒体”文件夹始终存在。必须创建“媒体”文件夹中的所有文件夹。在处理common.css文件之前,我想创建一个文件夹“/static/css”。mkdir偶尔抛出异常“文件存在”。如果它不存在,我试图创建一个文件夹。我假设“文件存在”是一个常见错误,因此该文件夹存在。我知道我给你的信息

PHP 使用 preg_match 或正则表达式作为 array_search 的值或 array_keys_exist 的键

我想知道是否可以在array_seach()或array_keys_exist中使用正则表达式或preg_match()?即。array_keys_exist($array,"^\d+$")匹配所有纯数字字符的键 最佳答案 我不知道它是否完全符合您的需求,但您应该看看preg_grep函数,它将根据正则表达式检查字符串数组并返回所有匹配的数组元素。您可以对键执行相同操作,方法是在array_keys的返回值上使用preg_grep.这与array_search/array_key_exists在这方面不同,它们在找到匹配项后停止,因

php - Symfony/Doctrine "refers to the owning side field which does not exist"- 但类中存在属性

SeUserProgress和SeUser。SeUserProgress表为每个用户保存多个条目。这通过以下两个映射表示。类:SeUserProgress/***@ORM\ManyToOne(targetEntity="SeUser",inversedBy="progress")*@ORM\Column(name="user_id",type="integer",nullable=true)*/private$user;类别:SeUser/***@ORM\OneToMany(targetEntity="SeUserProgress",mappedBy="user")*/private$

php - “The block type sonata.Admin.block.admin_list does not exist”

我是Symfony2的新手,在生成我的管理面板时遇到了这个问题。Anexceptionhasbeenoccurredduringtherenderingofatemplate("Theblocktypesonata.Admin.block.admin_listdoesnotexist")inSonataAdminBundle:Core:dashboard.html.twigatline35我正在关注此文档SonataAdminBundle. 最佳答案 你必须在app/config/config.yml中指定所有block,就像在th

php - 即使 file_exists() 声明文件存在,require() 也会失败

这是我的代码:if(file_exists('config.php')){require('config.php');//Thisisline38}以某种方式产生错误:Warning:require(config.php)[function.require]:failedtoopenstream:Nosuchfileordirectoryin/path/name/file.phponline38这怎么可能?更新:以下确实有效:if(file_exists(getcwd().'/config.php')){require(getcwd().'/config.php');}