有人可以帮我输出这个数组。不知道如何获得答案数组输出?
这是阵列输出:
这就是我到目前为止所做的:
foreach($questions as $question) {
echo $question['question'];
foreach($question['answer'] as $answer) {
'HOW DO I GET THE ANSWERS WHICH IS IN ARRAY'
}
答案 0 :(得分:2)
根据您的数组,在内部internal sealed class KeyboardInputEvents : InputEvents
{
public KeyboardInputEvents(DispatcherEvents dispatcherEvents) : base(dispatcherEvents)
{
EventManager.RegisterClassHandler(typeof(Window), UIElement.PreviewGotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(GotKeyboardFocus), true);
}
private void GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
var currentFrameworkElement = ((FrameworkElement)e.NewFocus);
System.Diagnostics.Debug.WriteLine(currentFrameworkElement.Name);
DependencyPropertyDescriptor desc = DependencyPropertyDescriptor.FromProperty(FrameworkElement.TagProperty, typeof(FrameworkElement));
desc.AddValueChanged(currentFrameworkElement, OnPropChanged);
}
private void OnPropChanged(object sender, EventArgs e)
{
//Changes were made, do something
}
}
循环中交换$question['answer']
$question['answers']
(注意复数形式的答案)。
答案 1 :(得分:1)
foreach($question as $question) {
echo $question['question'];
foreach($question['answers'] as $answer) {
echo $answer;
}
签出变量名称($ question,$ questions,$ question ['answers'],$ question ['answer'])