Symfony 2,传递变量
那么如何将变量传递到未与 symfony 连接的脚本中呢? 例如,我有变量 $a
,我在模板 a.html.php
中渲染它 如何在某些 example.php
脚本中使用此 $a
?
更接近:我想用TinyMCE图像管理器进行图像上传;但每个用户应该有自己的目录(对应于用户id)。所以我应该将变量 user_id 传递到图像管理器的 config.php 文件。
所以这个目录取决于用户的会话!如何为每个用户制作不同的目录来上传图像?或者你能告诉我如何处理这个问题吗?
也许使用另一个文本编辑器?我可以使用哪一个与 symfony 连接或为不同的用户使用不同的目录?
So how can I pass a variable into a script that is not connected with symfony?
For example, I have variable $a
, which I render in template a.html.php
How can I use this $a
in some example.php
script?
More close: I wanna make image uploading with TinyMCE image manager; but each user should have their own directory (which corresponds to user id). So I should pass variable user_id to config.php
file of image manager.
So this directory depends on the user's session! How can I make different dirs to upload images for each user? Or can you advise me how to deal with this problem?
Maybe to use another text editor? Which one can I connect with symfony or to use different directories for different users?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想与其他脚本共享信息,您可以将信息存储在会话中。在 example.php 中创建一个
var_dump($_SESSION)
来查看您已经拥有的内容。You can store information in the session if you want to share it with other scripts. Make a
var_dump($_SESSION)
in example.php to see what you already have.我用这个来处理数据和读取数据函数
I used this to handle data and read data function