可能是一个微不足道的问题,但我正在寻找一种方法来说明获取网站网址的根,例如:http://localhost/some/folder/containing/something/here/or/there应该返回http://localhost/
我知道有,$_SERVER['DOCUMENT_ROOT']但那不是我想要的.
我确信这很容易,但我一直在阅读:这篇文章试图找出我应该使用或调用的内容.
想法?
我所遇到的另一个问题是 - 这将是答案是什么,在网站上工作,http://subsite.localhost/some/folder/containing/something/here/or/there所以我的最终结果是http://subsite.localhost/
我制作了一个composer.json脚本.
当我跑sudo composer install,我得到这个错误:
[Seld\JsonLint\ParsingException]
"./composer.json" does not contain valid JSON
Parse error on line 1:
"repositories": [ { "t
--------------^
Expected one of: 'EOF', '}', ',', ']'
Run Code Online (Sandbox Code Playgroud)
这是JSON:
"repositories": [
{
"type":"package",
"package": {
"name": "AdamKyle/Aisis-Core",
"version":"development",
"source": {
"url": "https://github.com/AdamKyle/Aisis-Core.git",
"type": "git",
"reference":"development"
}
}
}
],
"require": {
"AdamKyle/Aisis-Core": "development"
}
Run Code Online (Sandbox Code Playgroud)
如何更好地描述此JSON是如何错误的?
我已经看到了很多这些问题,但他们的解决方案都没有对我有用.我有一个这样的测试:
describe RolesController do
describe "#delet" do
context "When the user is logged in" do
let(:user) {FactoryGirl.create(:user)}
let(:admin) {FactoryGirl.create(:admin)}
let(:adminRole) {FactoryGirl.create(:adminRole)}
it "Should allow admins to delete roles" do
sign_in admin
put :destroy, :id => adminRole.id
end
end
end
end
Run Code Online (Sandbox Code Playgroud)
简单,简单,简单.但我得到了典型的错误:
1) RolesController#delet When the user is logged in Should allow admins to delete roles
Failure/Error: Unable to find matching line from backtrace
SystemStackError:
stack level too deep
# /home/adam/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:23
Run Code Online (Sandbox Code Playgroud)
而且我都喜欢......什么?我再次阅读了几十个关于此问题的问题,这似乎与工厂女孩有关,但我看不出这里的问题是什么.我有很多其他测试实例化像这样的工厂女孩对象没有问题.