Note that there are some explanatory texts on larger screens.

plurals
  1. POfile_exists() and expired cache not following logic
    primarykey
    data
    text
    <p>Logically I am trying to figure out why my code is not working.</p> <pre><code>foreach($list as $persona){ //If file exists if(file_exists('templates/cache/' . $persona['toolbar_id'] . 'txt')){ //file is expired older than 10 seconds for testing purposes if(time() - filemtime('/templates/cache/' . $persona['toolbar_id'] . '.txt') &gt;= 10) { // jSON URL which should be requested $json_url = 'example'; // Initializing curl $ch = curl_init( $json_url ); // Configuring curl options $options = array( CURLOPT_RETURNTRANSFER =&gt; true, CURLOPT_HTTPHEADER =&gt; array('Content-type: application/json') , ); // Setting curl options curl_setopt_array( $ch, $options ); // Getting results $result = curl_exec($ch); // Getting jSON result string file_put_contents('templates/cache/' . $persona['toolbar_id']. '.txt', $result); $result = json_decode($result, true); $result = $result[0]; echo 'expired-recreating cache'; } $result = json_decode(file_get_contents('templates/cache/' . $persona['toolbar_id']. '.txt'), true); $result = $result[0]; } // jSON URL which should be requested $json_url = '''; // Initializing curl $ch = curl_init( $json_url ); // Configuring curl options $options = array( CURLOPT_RETURNTRANSFER =&gt; true, CURLOPT_HTTPHEADER =&gt; array('Content-type: application/json') , CURLOPT_POSTFIELDS =&gt; $json_string ); // Setting curl options curl_setopt_array( $ch, $options ); // Getting results $result = curl_exec($ch); // Getting jSON result string file_put_contents('templates/cache/' . $persona['toolbar_id']. '.txt', $result); $result = json_decode($result, true); $result = $result[0]; echo 'didnt exist'; } </code></pre> <p>I am always ending up with the results of the echo 'didnt exist.' Any help here is greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload