How to deal with this HTML code echoed with PHP which as both single and double quotes?

前端 未结 6 1291
鱼传尺愫
鱼传尺愫 2021-01-16 15:57

I\'m not sure if this is a cleaner way of writing this, but I think I don\'t have problems here:



        
6条回答
  •  粉色の甜心
    2021-01-16 16:47

    If you really want to output PHP code:

    ">
            
            ';
            break;
        default:
           echo '';
    
    ?>
    

    Otherwise this makes more sense to me:

    ">'.
              htmlspecialchars( $data[ $meta_box['name'] ] ).
            '';
            break;
        default:
           echo '';
    }
    
    ?>
    

    But I guess that $data[$meta_box['name']] array index isn't correct either.

提交回复
热议问题