Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果用户登录到网站,如何添加 javascript 文件或 javascript 代码?
该网站是用drupal 7构建的。
试试下面的代码:
global $user; if($user->uid != 0) { drupal_add_js("PATH_TO_JS_FILE"); }
希望这会有所帮助……穆罕默德。