如果我在PHP中编写代码,我有理由使用CSS预处理器而不是PHP吗?例如,我可以在我的CSS文件中使用PHP,方法是在我的标题中使用:
<link rel="stylesheet" type="text/css" media="all" href="style.php" />
Run Code Online (Sandbox Code Playgroud)
那样我就可以传递变量了 style.php?color=#000
或者我可以使用像LESS这样的东西来预处理我的CSS.如果我使用less.js,我不知道如何能够像上一个例子中那样传递变量.
现在,我听说PHP CSS文件无法缓存,所以我可以看出为什么会出现问题,特别是如果CSS文件很大的话.但我希望能够将变量传递给我的CSS表.
有人能告诉我为什么我会使用其中一个,和/或如果我使用less.js我将如何将变量传递给我的.less文件?
我有一个 Heroku 1X dyno,它在重新启动时立即消耗其所有内存。
这是日志中的重启:
2020-05-18T16:57:54.119229+00:00 app[web.1]: Stopping php-fpm...
2020-05-18T16:57:54.119814+00:00 app[web.1]: Stopping httpd gracefully...
2020-05-18T16:57:54.121897+00:00 app[web.1]: Stopping httpd...
2020-05-18T16:57:54.131154+00:00 app[web.1]: Shutdown complete.
2020-05-18T16:57:54.194178+00:00 heroku[web.1]: Process exited with status 143
2020-05-18T16:57:57.194751+00:00 app[web.1]: Detected 536870912 Bytes of RAM
2020-05-18T16:57:57.231186+00:00 app[web.1]: PHP memory_limit is 4M Bytes
2020-05-18T16:57:57.245920+00:00 app[web.1]: Starting php-fpm with 128 workers...
2020-05-18T16:57:57.386605+00:00 app[web.1]: Starting httpd...
2020-05-18T16:57:58.220510+00:00 heroku[web.1]: State changed from starting to up
Run Code Online (Sandbox Code Playgroud)
我的 procfile 只是:
web: vendor/bin/heroku-php-apache2
Run Code Online (Sandbox Code Playgroud)
我的 .user.ini 是:
memory_limit = 4M
Run Code Online (Sandbox Code Playgroud)
这些代码都没有设置为在后台运行,它只是一个处理请求的 API。然而,它立即消耗了最大内存并抛出了 R14 错误,有 0 个请求进入。https://share.getcloudapp.com/GGukb5QZ …
我使用以下方式检索客户:
$customer = Stripe_Customer::retrieve( $customer_id );
当我使用时$customer->subscriptions->create($array),我收到一条错误消息:
Fatal error: Call to undefined method Stripe_Object::create()
我可以使用添加订阅$customer->updateSubscription($array)并且工作正常,但这不允许我向同一个客户添加同一计划的多个订阅.知道我做错了什么吗?
编辑:
这是$ customer的打印:
object(Stripe_Customer)[135]
protected '_apiKey' => string 'sk_test_...' (length=32)
protected '_values' =>
array (size=14)
'id' => string 'cus_...' (length=18)
'object' => string 'customer' (length=8)
'created' => int 1415377515
'livemode' => boolean false
'description' => null
'email' => string 'email' (length=25)
'delinquent' => boolean false
'metadata' =>
object(Stripe_Object)[333]
protected '_apiKey' => string 'sk_test_...' (length=32)
protected '_values' =>
array (size=1)
'user_id' => …Run Code Online (Sandbox Code Playgroud)