我对PHP比较陌生,我想知道是否有可能用PHP中的服务器上的 #something 修改当前的URL(或者我猜另一种语言;也许是JavaScript)?
感谢您的帮助,
abarnybox
答案 0 :(得分:1)
使用javascript
Intent myIntent = new Intent(getActivity(), MyReceiver.class);
if(PendingIntent.getBroadcast(getActivity(), 0, myIntent, PendingIntent.FLAG_NO_CREATE) == null){
pendingIntent = PendingIntent.getBroadcast(getActivity(), 0, myIntent,0);
alarmManager = (AlarmManager)getActivity().getSystemService(Context.ALARM_SERVICE);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pendingIntent);
}
用php
window.location=window.location+'#something'
答案 1 :(得分:1)
使用当前网址
添加#something的另一种最简单方法JS:
var e = "something";
window.history.pushState(" ", "", "#" + e)