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.
我是新手,但由于某种原因,它不会加载 css 或图像。我把它们都放在同一个目录中:
代码只是:
<link rel='stylesheet' href="styles.css"> <img src='/pic.jpg' align="left" width="150" height="150">
但是,无论我尝试什么,它们都不会加载。那么有人可以回答我吗?
首先,确保您已经正确设置了静态路由:
"routes":[ ["method":"get", "uri":"/**", "handler":PerfectHTTPServer.HTTPHandler.staticFiles, "documentRoot":"./webroot"] ]
然后尝试“快速构建”并在终端中运行应用程序
如果使用 Xcode,请从 Xcode“运行”中选择“编辑方案”,并将“工作目录”选项设置为“$(PROJECT_DIR)”。