草庐IT

install_requires

全部标签

php - Laravel 验证 : required_with_all condition always passing

根据laravelvalidationdocumentation:required_with_all:foo,bar,...Thefieldundervalidationmustbepresentonlyifalloftheotherspecifiedfieldsarepresent.这是我的测试:Route::get('/test/{param}',function($param){$screenRules=array('foo'=>'string','param'=>'required_with_all:foo',);$validator=Validator::make(array

php - 如何在 require 中使用根路径?

我在站点中有一个私有(private)部分,其文件夹结构如下www.site.com/privatePath/secretFolder/login.php然后是一些子文件夹,例如www.site.com/privatePath/secretFolder/grandmasRecipes/applePie.php在login.php旁边有一个共享的functions.phpwww.site.com/privatePath/secretFolder/functions.php(创建$connection,mysql等等)我有各种子文件夹和文件,我希望连接到functions.php,其中一些

php - 哪个更好 : require_once? 或 if (!defined ('FOOBAR' )) require?还是完全不同的东西?

假设PHP版本>=5.2,这是一个更好的管理解决方案,包括:require_onceDEFPATH.'config.inc.php';或if(!defined('FOOBAR'))requireDEFPATH.'config.inc.php';还是完全不同的东西?站点不使用前端Controller或自动加载器。需要包含的文件的典型数量为3-8。我在这里和其他地方听说过,require_once会增加开销并且不适合缓存。但我也听说在PHP的更高版本中,少量的require_once语句在实践中是可以的。还必须有一些与检查是否定义了某些内容相关的开销,但这可能不是一个问题。一般来说,哪种做

php - require() 和 include() 语句在条件语句中的行为是否不同?

我想看看除了需要它或要求它之外是否还有任何理由(因此得名)。我偶然发现了这个声明:Unlikeinclude(),require()willalwaysreadinthetargetfile,evenifthelineit'sonneverexecutes.Ifyouwanttoconditionallyincludeafile,useinclude().Theconditionalstatementwon'taffecttherequire().However,ifthelineonwhichtherequire()occursisnotexecuted,neitherwillany

php - 为什么我要使用 spl_autoload_register 而不是 include 或 require 类和函数?

我不明白spl_autoload_register或autoload是做什么的。为什么我不直接使用include或require?我没有看到明确的答案。 最佳答案 自动加载函数或类的优点是:如果您有很多类,则无需手动包含它们。以ZendFramework为例:您不想手动加载所有这些类。使用自动加载器,只需创建一个新类并开始在所有(启用自动加载器的)文件中使用它。仅加载请求中实际使用的文件,从而可能节省资源。如果您只使用50个文件中的10个,为什么要加载其他40个?它迫使你有一个合理的目录布局(毕竟,你需要一些规则,这样你的自动加载器

php - 使用 PHP 的 exec() 给出错误 : Fatal: [Errno 2] No such file or directory; did you install

我正在尝试使用PHPexec()二进制casperjs,exec('casperjs/var/www/mysite/application/phantomjs/test.js');但是我得到了错误Fatal:[Errno2]Nosuchfileordirectory;didyouinstallphantomjs?CasperJS运行在PhantomJS之上,我在/usr/local/bin/phantomjs和/usr/local/bin/casperjs手动安装并创建了一个链接>。所以我猜casperjs在运行时会调用phantomjs。但是当我ssh进入服务器并运行时它工作正常ca

php - 如何从不同的目录中 require_once?

我试图从不同文件夹中的php文件中获取我的“库”文件,但在尝试从子文件夹访问它们时出现错误。比如我有这样一个目录:+home-file1.php++subfolder-file2.php++libraries-code_generator.php-database_library.phpcode_generator.php还依赖于其他库:(LINE25)require_once(realpath("./libraries/database_library.php"));//thisworksfinewhencalledfromfile1.php,butnotfromfile2.php我

php - PHP 的 Google API 客户端中的 required_once 问题

我一直在尝试在我的php脚本文件中导入/包含文件,但不知何故它不起作用。我知道这个require_once问题已经被问了很多次[1.require_oncewithsubfolders,2.require_once()cantfindtheincludepath,3.Usingrequire_onceforupdirectorynotworking]但他们似乎都不适合我。下图将清楚地说明我要做什么:我的尝试和错误:尝试1require_once(__DIR__.'GoogleClientApi/src/Google/Service/Analytics.php');echo'Hey1';

php - sudo composer install 与 composer install

我运行sudocomposerinstall我收到了这个警告DonotrunComposerasroot/superuser!Seehttps://getcomposer.org/rootfordetails我只是尝试了composerinstall我得到了这个错误[ErrorException]file_put_contents(/Applications/MAMP/htdocs/code/bheng/vendor/composer/installed.json):failedtoopenstream:Permissiondenied这是我的Laravel文件夹的当前权限集total

解决报错:Uncaught TypeError: Cannot read properties of undefined (reading ‘install‘)

在做vue2项目时出现如下错误,页面空白且控制台出现如下错误:报错内容:UncaughtTypeError:Cannotreadpropertiesofundefined(reading'install')  atVue.use(vue.runtime.esm.js?c320:5709:1)  ateval(index.js?5aa4:7:1)  at./src/router/index.js(app.js:491:1)  at__webpack_require__(app.js:584:33)  atfn(app.js:818:21)  ateval(main.js:4:65)  at./s