PHP - $ _SERVER [' QUERY_STRING']有"&"

时间:2015-12-04 17:31:30

标签: php modx

在我的php脚本中,我试图获取查询字符串($ _SERVER [' QUERY_STRING']),将其附加到另一个网址,然后进行重定向。

如果我在没有任何处理的情况下使用查询字符串,则新网址会显示"&安培;"对于所有"&'" s。因此,新的网址不会起作用。

我打印出$ _SERVER [' QUERY_STRING']并查看页面来源。它确实使用"&安培;"对于所有"&'" s。它对我没有意义,我想知道为什么。它只是我的服务器配置还是PHP的默认配置?

更新:我使用片段在MODX CMS上测试了它。如果在常规PHP脚本上运行,则不存在此类问题。我想问题出在MODX上。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

只是一个想法: 如果您使用TinyMCE编辑内容,它会将所有<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:btl="clr-namespace:NumericSpinner" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" mc:Ignorable="d"> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/NumericSpinner;component/Resources/AllBrushes.xaml" /> </ResourceDictionary.MergedDictionaries> <Style TargetType="{x:Type btl:NumericSpinnerControl}"> <Setter Property="HorizontalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type btl:NumericSpinnerControl}"> <Grid Background="{Binding Path=Background, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" > <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> </Grid.RowDefinitions> <!-- we use the TemplatedParent binding to get a reference to the control this template has been applied to, so we can access the property on it --> <TextBox Grid.Row="0" Grid.Column="0" Width="Auto" Margin="0,0,1,0" VerticalAlignment="Center" BorderThickness="0" BorderBrush="Transparent" IsReadOnly="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsReadOnly, Mode=TwoWay}" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=FormattedValue, Mode=TwoWay, NotifyOnTargetUpdated=True, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus, NotifyOnValidationError=True}" btl:TextBoxBehavior.SelectAllTextOnFocus ="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectAllOnGotFocus, Mode=TwoWay}" > </TextBox> <Grid x:Name="grid1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <RepeatButton Grid.Row="0" Grid.Column="1" Width="22" Height="11" Background="Transparent" IsEnabled="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CanIncrement}" Command="{x:Static btl:NumericSpinnerControl.IncreaseCommand}" MouseUp="{x:Static btl:NumericSpinnerControl.MouseUpCommand}"> <RepeatButton.Content> <Rectangle Width="16" Height="5" Fill="{StaticResource BrushScrollUp}" /> </RepeatButton.Content> <RepeatButton.InputBindings> <MouseBinding MouseAction="RightClick" Command="{x:Static btl:NumericSpinnerControl.SetValueToMaximumCommand}"/> </RepeatButton.InputBindings> </RepeatButton> <RepeatButton Grid.Row="1" Grid.Column="1" Width="22" Height="11" Background="Transparent" IsEnabled="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CanDecrement}" Command="{x:Static btl:NumericSpinnerControl.DecreaseCommand}"> <RepeatButton.Content> <Rectangle Width="16" Height="5" Fill="{StaticResource BrushScrollDown}" /> </RepeatButton.Content> <RepeatButton.InputBindings> <MouseBinding MouseAction="RightClick" Command="{x:Static btl:NumericSpinnerControl.SetValueToMinimumCommand}"/> </RepeatButton.InputBindings> </RepeatButton> </Grid> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <!-- Resource dictionary entries should be defined here. --> </ResourceDictionary> 更改为public static RoutedCommand IncreaseCommand { get; set; } protected static void OnIncreaseCommand(Object sender, ExecutedRoutedEventArgs e) { NumericSpinnerControl control = sender as NumericSpinnerControl; if (control != null) { Console.WriteLine("Pressed"); control.OnIncrease(); } } protected void OnIncrease() { Value = LimitValueByBounds(Value + Increment, this); } public static RoutedCommand MouseUpCommand { get; set; } protected static void OnMouseUpCommand(Object sender, ExecutedRoutedEventArgs e) { NumericSpinnerControl control = sender as NumericSpinnerControl; if (control != null) { Console.WriteLine("mouse up"); } } private static void InitializeCommands() { // create instances IncreaseCommand = new RoutedCommand("IncreaseCommand", typeof(NumericSpinnerControl)); MouseUpCommand = new RoutedCommand("MouseUpCommand", typeof(NumericSpinnerControl)); // register the command bindings - if the buttons get clicked, call these methods. CommandManager.RegisterClassCommandBinding(typeof(NumericSpinnerControl), new CommandBinding(IncreaseCommand, OnIncreaseCommand)); CommandManager.RegisterClassCommandBinding(typeof(NumericSpinnerControl), new CommandBinding(MouseUpCommand, OnMouseUpCommand)); } - 这一直让我疯狂了许多次。这种情况发生在代码段调用中,如果您停用资源的富文本编辑器或者快速编辑&#34;可以调试它。资源。

同样很好的做法:将片段调用放入。您可以调用该块,而不会冒使用代码段调用的语法。