树枝:将用户名和密码添加到`absolute_url()`中

时间:2019-02-22 15:12:06

标签: php symfony twig

是否可以在Twig中生成包含用户名和密码的绝对URL?:

case

1 个答案:

答案 0 :(得分:0)

我建议将此作为class Program { class X { // protected / public internal void GetX() { Console.WriteLine("X"); } protected void GetZ() { Console.WriteLine("Z"); } } class Y : X { public void GetXZ() { GetX();// within class, I can access Internal method from base class. GetZ();// within class, I can access Protected method from base class. } } static void Main(string[] args) { var y = new Y(); y.GetX(); // Works y.GetZ(); //Does Not Work (Protected method, can't be accessed outside of a derived class) y.GetXZ();// Works Console.ReadKey(); } } 的功能,但遭到拒绝:https://github.com/symfony/symfony/issues/30281

这是我想出的自制解决方案:创建以下Custom Twig Filter

http://foo:bar@example.com/

并像这样使用它:

absolute_url()