php - WP import data from file at server side and pick each data to echo -


i'm developing wordpress plugin site private page each member. inside plugin folder want include directory text file each member data retrieved upon page load , populated divs. not want file accessible user guess xml or json files should discarded.

  1. which method allow me import data "text" file , hide user?
  2. how can pick lines function echoed div?

sorry terrible code, i'm still learning

jquery('#mydiv').text('<?php echo get_user_file_data(); ?>');        add_action( 'wp_ajax_get_user_file_data', 'get_user_file_data' );     function get_user_file_data() {         include( plugin_dir_path( __file__ ) . 'includes/myfile.txt');         $myfile = "myfile.txt";         $lines = file($myfile);//file in array         var_dump($lines);          foreach($lines $line)          {             $var = explode(':', $line, 2);             $arr[$var[0]] = $var[1];         }         return $arr;     } 


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -