Jump to content

Saving to file programatically - a puzzle


zota
 Share

Recommended Posts

Hi!

The following code does this:
(a) $p survives to the test, (never echoes "stupid!")

so (b) resend $p->textJSon, (believing on the browser's client side console)

BUT ( c) does not save $value to  $p->textJSon (both reload and back side prove it)

The puzzle: how can (b) and © been compatible?

Thanks
(btw: $p should not be necessary, as I post to  "./". So $page should be enough, right? But result was exactly - or looks - the same)

<?php
if($config->ajax) {
      
   $value = json_decode(file_get_contents('php://input'));
   $p = $pages->get("/hot/");    
   if (!($p instanceof NullPage)) {
    	$p->of(false);
    	$p->textJSon = $value;
   	echo json_encode($p->textJSon, JSON_UNESCAPED_UNICODE) ;
   } else { 
   	echo 'stupid!' ;
   }   
   return;
} else {
... include head, foot, and so...
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...