URL中“#” “?” &“”号的作用

本文详细介绍了URL中#、?和&三个特殊符号的用途。#用于页面内部定位,不参与HTTP请求,改变#值不会重新加载页面但会更新浏览器历史。?和&用于GET请求参数,#后的内容可用于AJAX应用的URL回溯,Google通过"#!"抓取动态内容。?

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

window.location.href这个属性用于获取页面URL地址,其实原生JavaScript真是什么都有.
window.location对象所包含的属性:

window.location.hash
要使用JS定位锚点,完全可以使用window.hash配合元素ID完成.比如快速定位到页面的某条评论,则直接使用如下代码即可:
window.location.hash = "#comment-5981";
另外Twitter、Facebook、Google 等已经开始大量使用 #!这种形式的hash方法处理异步交互页面的URL可回溯功能。

window.location.search
如果有这样一个 URL 地址:
http://www.google.com.hk/search?hl=zh-CN&source=hp&biw=1400&bih=935&q=%E8%8A%92%E6%9E%9C%E5%B0%8F%E7%AB%99&aq=f&aqi=&aql=&oq=
如何利用JS脚本捕获页面GET方式请求的参数?其实直接使用window.location.search获得,然后通过split方法结合循环遍历自由组织数据格式。
另外,如果根据用户的搜索条件刷新页面,只需直接设置window.location.search即可。

属性 描述

# ???? WEB ???? server.port=7090 server.servlet.context-path=/api #session???? 60M ???? server.servlet.session.timeout=PT60M #??favicon spring.mvc.favicon.enable=false #???? spring.mvc.throw-exception-if-no-handler-found=true spring.web.resources.add-mappings=false spring.servlet.multipart.max-file-size=20MB spring.servlet.multipart.max-request-size=20MB #数据库设置 spring.datasource.url=jdbc:mysql://118.24.147.138:3306/wangpan?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true spring.datasource.username=wangpan spring.datasource.password=rootroot spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.hikari.pool-name=HikariCPDatasource spring.datasource.hikari.minimum-idle=5 spring.datasource.hikari.idle-timeout=180000 spring.datasource.hikari.maximum-pool-size=10 spring.datasource.hikari.auto-commit=true spring.datasource.hikari.max-lifetime=1800000 spring.datasource.hikari.connection-timeout=30000 spring.datasource.hikari.connection-test-query=SELECT 1 #???????? # ?????????? smtp.qq.com spring.mail.host=smtp.qq.com # ??????? spring.mail.port=465 # ??? spring.mail.username=3824245251@qq.com # spring.mail.password=ehcyxusufuulccah # ???? spring.mail.default-encoding=UTF-8 # SSL???? spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory # ?? debug???????????????? spring.mail.properties.mail.debug=true #?????? #Spring redis?? # Redis?????????0? spring.redis.database=0 spring.redis.host=118.24.147.138 spring.redis.port=6379 # ???????????????????? spring.redis.jedis.pool.max-active=20 # ??????????????????????? spring.redis.jedis.pool.max-wait=-1 # ??????????? spring.redis.jedis.pool.max-idle=10 # ??????????? spring.redis.jedis.pool.min-idle=0 # ?????????? spring.redis.timeout=2000 #项目目录 project.folder=/www/wangpan/ # log.root.level=debug #内部端口 inner.api.appKey=wangpan inner.api.appSecret=wangpan_key #web端口 web.api.url=http://118.24.147.138:7090 #管理员id admin.emails=961285867@qq.com #是否是开发环境 dev=false ##qq????## qq.app.id=12333 qq.app.key=2222222 qq.url.authorization=https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=%s&redirect_uri=%s&state=%s qq.url.access.token=https://graph.qq.com/oauth2.0/token?grant_type=authorization_code&client_id=%s&client_secret=%s&code=%s&redirect_uri=%s qq.url.openid=https://graph.qq.com/oauth2.0/me?access_token=%S qq.url.user.info=https://graph.qq.com/user/get_user_info?access_token=%s&oauth_consumer_key=%s&openid=%s qq.url.redirect=http://wangpan.wuhancoder.com/qqlogincalback springboot的配置文件,部署到服务器上,有什么错误吗
最新发布
05-13
### Spring Boot 配置文件检查与服务器部署指南 在Spring Boot项目中,`application.properties` 或 `application.yml` 是核心配置文件,负责定义各种环境变量服务参数。以下是关于如何验证配置文件的正确性以及确保其在服务器上的成功部署的相关说明: --- #### **1. Server Port 配置** 默认情况下,Spring Boot 应用程序监听8080端口。可以通过设置`server.port`来更改此行为。如果指定的端口已被占用或者超出范围(如大于65535),则会抛出绑定异常[^1]。 ```properties # Example of setting custom server port in application.properties server.port=9090 ``` > 如果需要动态获取实际使用的端口(即使它被随机分配),可以在日志输出或通过JMX接口查看。 --- #### **2. Redis 数据库连接校验** 当遇到类似于`org.springframework.data.redis.RedisConnectionFailureException` 的错误时,应重点排查以下几个方面: - 网络可达性:确认目标主机地址(`spring.redis.host`) 端口 (`spring.redis.port`) 是否可访问; - 凭证有效性:如果有密码保护,请核对字段`sprng.redis.password` 值是否匹配; - 资源权限:某些云托管平台可能还需要额外的安全组规则允许外部IP访问Redis实例。 示例配置片段如下所示[^1]: ```properties spring.redis.host=localhost spring.redis.port=6379 spring.redis.password= spring.redis.database=0 ``` 另外值得注意的是,即便基础信息无误,仍需考虑超时设定不合理引发的问题。例如socket timeout太短可能导致短暂网络波动期间判定失败。 --- #### **3. QQ 登录集成** 为了实现QQ登录功能,除了常规OAuth2客户端注册外,还需妥善维护回调URL一致性,并合理规划用户映射逻辑。具体而言,应在`application.properties` 中加入类似下面的内容: ```properties qq.app.id=your_app_id_here qq.app.key=your_secret_key_here security.oauth2.client.registration.qq.client-id=${qq.app.id} security.oauth2.client.registration.qq.client-secret=${qq.app.key} ``` 同时记得更新安全过滤器链以支持新的授权类型[^4]. --- #### **4. 邮件服务配置** 发送电子邮件通常涉及到SMTP协议的支持。这里列举几个常用的Gmail SMTP例子供参考: ```properties spring.mail.host=smtp.gmail.com spring.mail.port=587 spring.mail.username=user@gmail.com spring.mail.password=email_password spring.mail.protocol=smtp spring.mail.smtp.auth=true spring.mail.smtp.starttls.enable=true ``` 注意替换占位符为真实账户凭证前务必保管好敏感资料. --- #### **5. Session 存储至 Redis** 启用基于Redis的HttpSession共享非常简单,只需添加相应starter依赖并标注@EnableRedisHttpSession即可[^2]. 下面给出一段典型声明形式: ```java @Configuration @EnableRedisHttpSession public class HttpSessionConfig { // Additional configurations can be added here if needed. } ``` 一旦激活上述开关后,所有的session对象都会序列化保存到远程Redis节点上,从而极大简化了水平扩展过程中保持状态一致性的难度[^4]. --- #### **6. 超时设置** 无论是HTTP请求还是数据库交互都不可避免存在延时期望的情况。因此适当地调节这些阈值有助于提升用户体验同时也防止不必要的资源浪费。举个简单的GET调用为例: ```properties ribbon.ReadTimeout=5000 ribbon.ConnectTimeout=3000 ``` 以上分别代表读取等待最大时限(ms)初次握手所需时间限制(ms)[^1]. --- #### **7. Liquibase ChangeLog 定义** 最后提及一下版本控制工具Liquibase的作用域定位问题。按照惯例它的根目录位于类路径下`/db/changelog/`,但也可以自定义其他位置以便更好地组织变更脚本集合[^3]: ```yaml liquibase: change-log: classpath:/custom/path/to/changelog.xml ``` 这样做的好处是可以按模块划分各自独立演化的DDL/DML语句集而不至于混乱不堪. --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值